aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/src/SpecTestsuites/Core/LabelsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/SpecTestsuites/Core/LabelsTest.php')
-rw-r--r--tests/src/SpecTestsuites/Core/LabelsTest.php325
1 files changed, 325 insertions, 0 deletions
diff --git a/tests/src/SpecTestsuites/Core/LabelsTest.php b/tests/src/SpecTestsuites/Core/LabelsTest.php
new file mode 100644
index 0000000..cfab89d
--- /dev/null
+++ b/tests/src/SpecTestsuites/Core/LabelsTest.php
@@ -0,0 +1,325 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\Tests\SpecTestsuites\Core;
+
+use Nsfisis\Waddiwasi\Tests\SpecTestsuites\SpecTestsuiteBase;
+use PHPUnit\Framework\Attributes\Depends;
+
+final class LabelsTest extends SpecTestsuiteBase
+{
+ public function testModule0(): void
+ {
+ $this->runModuleCommand(
+ filename: 'labels.0.wasm',
+ name: null,
+ line: 1,
+ );
+ }
+
+ #[Depends('testModule0')]
+ public function testAssertReturn1(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'block', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '1']],
+ line: 291,
+ );
+ }
+
+ #[Depends('testAssertReturn1')]
+ public function testAssertReturn2(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'loop1', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '5']],
+ line: 292,
+ );
+ }
+
+ #[Depends('testAssertReturn2')]
+ public function testAssertReturn3(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'loop2', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '8']],
+ line: 293,
+ );
+ }
+
+ #[Depends('testAssertReturn3')]
+ public function testAssertReturn4(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'loop3', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '1']],
+ line: 294,
+ );
+ }
+
+ #[Depends('testAssertReturn4')]
+ public function testAssertReturn5(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'loop4', 'args' => [['type' => 'i32', 'value' => '8']]],
+ expected: [['type' => 'i32', 'value' => '16']],
+ line: 295,
+ );
+ }
+
+ #[Depends('testAssertReturn5')]
+ public function testAssertReturn6(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'loop5', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '2']],
+ line: 296,
+ );
+ }
+
+ #[Depends('testAssertReturn6')]
+ public function testAssertReturn7(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'loop6', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '3']],
+ line: 297,
+ );
+ }
+
+ #[Depends('testAssertReturn7')]
+ public function testAssertReturn8(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'if', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '5']],
+ line: 298,
+ );
+ }
+
+ #[Depends('testAssertReturn8')]
+ public function testAssertReturn9(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'if2', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '5']],
+ line: 299,
+ );
+ }
+
+ #[Depends('testAssertReturn9')]
+ public function testAssertReturn10(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'switch', 'args' => [['type' => 'i32', 'value' => '0']]],
+ expected: [['type' => 'i32', 'value' => '50']],
+ line: 300,
+ );
+ }
+
+ #[Depends('testAssertReturn10')]
+ public function testAssertReturn11(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'switch', 'args' => [['type' => 'i32', 'value' => '1']]],
+ expected: [['type' => 'i32', 'value' => '20']],
+ line: 301,
+ );
+ }
+
+ #[Depends('testAssertReturn11')]
+ public function testAssertReturn12(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'switch', 'args' => [['type' => 'i32', 'value' => '2']]],
+ expected: [['type' => 'i32', 'value' => '20']],
+ line: 302,
+ );
+ }
+
+ #[Depends('testAssertReturn12')]
+ public function testAssertReturn13(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'switch', 'args' => [['type' => 'i32', 'value' => '3']]],
+ expected: [['type' => 'i32', 'value' => '3']],
+ line: 303,
+ );
+ }
+
+ #[Depends('testAssertReturn13')]
+ public function testAssertReturn14(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'switch', 'args' => [['type' => 'i32', 'value' => '4']]],
+ expected: [['type' => 'i32', 'value' => '50']],
+ line: 304,
+ );
+ }
+
+ #[Depends('testAssertReturn14')]
+ public function testAssertReturn15(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'switch', 'args' => [['type' => 'i32', 'value' => '5']]],
+ expected: [['type' => 'i32', 'value' => '50']],
+ line: 305,
+ );
+ }
+
+ #[Depends('testAssertReturn15')]
+ public function testAssertReturn16(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'return', 'args' => [['type' => 'i32', 'value' => '0']]],
+ expected: [['type' => 'i32', 'value' => '0']],
+ line: 306,
+ );
+ }
+
+ #[Depends('testAssertReturn16')]
+ public function testAssertReturn17(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'return', 'args' => [['type' => 'i32', 'value' => '1']]],
+ expected: [['type' => 'i32', 'value' => '2']],
+ line: 307,
+ );
+ }
+
+ #[Depends('testAssertReturn17')]
+ public function testAssertReturn18(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'return', 'args' => [['type' => 'i32', 'value' => '2']]],
+ expected: [['type' => 'i32', 'value' => '2']],
+ line: 308,
+ );
+ }
+
+ #[Depends('testAssertReturn18')]
+ public function testAssertReturn19(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'br_if0', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '29']],
+ line: 309,
+ );
+ }
+
+ #[Depends('testAssertReturn19')]
+ public function testAssertReturn20(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'br_if1', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '1']],
+ line: 310,
+ );
+ }
+
+ #[Depends('testAssertReturn20')]
+ public function testAssertReturn21(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'br_if2', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '1']],
+ line: 311,
+ );
+ }
+
+ #[Depends('testAssertReturn21')]
+ public function testAssertReturn22(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'br_if3', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '2']],
+ line: 312,
+ );
+ }
+
+ #[Depends('testAssertReturn22')]
+ public function testAssertReturn23(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'br', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '1']],
+ line: 313,
+ );
+ }
+
+ #[Depends('testAssertReturn23')]
+ public function testAssertReturn24(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'shadowing', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '1']],
+ line: 314,
+ );
+ }
+
+ #[Depends('testAssertReturn24')]
+ public function testAssertReturn25(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'redefinition', 'args' => []],
+ expected: [['type' => 'i32', 'value' => '5']],
+ line: 315,
+ );
+ }
+
+ #[Depends('testAssertReturn25')]
+ public function testAssertInvalid26(): void
+ {
+ $this->runAssertInvalidCommand(
+ filename: 'labels.1.wasm',
+ text: 'type mismatch',
+ line: 318,
+ );
+ }
+
+ #[Depends('testAssertInvalid26')]
+ public function testAssertInvalid27(): void
+ {
+ $this->runAssertInvalidCommand(
+ filename: 'labels.2.wasm',
+ text: 'type mismatch',
+ line: 322,
+ );
+ }
+
+ #[Depends('testAssertInvalid27')]
+ public function testAssertInvalid28(): void
+ {
+ $this->runAssertInvalidCommand(
+ filename: 'labels.3.wasm',
+ text: 'type mismatch',
+ line: 326,
+ );
+ }
+}