aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/src/SpecTestsuites/Core/FacTest.php
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-04-28 11:02:51 +0900
committernsfisis <nsfisis@gmail.com>2024-04-28 17:38:19 +0900
commit88a77bc5846541e5d6009bc103da378650a649f3 (patch)
treeef4d3a57cc16bf230c3ac25068001f747e45b35e /tests/src/SpecTestsuites/Core/FacTest.php
parentc809cd661bba388d531f24c2ac578fbe6594f45c (diff)
downloadphp-waddiwasi-88a77bc5846541e5d6009bc103da378650a649f3.tar.gz
php-waddiwasi-88a77bc5846541e5d6009bc103da378650a649f3.tar.zst
php-waddiwasi-88a77bc5846541e5d6009bc103da378650a649f3.zip
test: generate PHPUnit classes from WAST files
Diffstat (limited to 'tests/src/SpecTestsuites/Core/FacTest.php')
-rw-r--r--tests/src/SpecTestsuites/Core/FacTest.php96
1 files changed, 96 insertions, 0 deletions
diff --git a/tests/src/SpecTestsuites/Core/FacTest.php b/tests/src/SpecTestsuites/Core/FacTest.php
new file mode 100644
index 0000000..2db83d9
--- /dev/null
+++ b/tests/src/SpecTestsuites/Core/FacTest.php
@@ -0,0 +1,96 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Nsfisis\Waddiwasi\Tests\SpecTestsuites\Core;
+
+use Nsfisis\Waddiwasi\Tests\SpecTestsuites\SpecTestsuiteBase;
+use PHPUnit\Framework\Attributes\Depends;
+
+final class FacTest extends SpecTestsuiteBase
+{
+ public function testModule0(): void
+ {
+ $this->runModuleCommand(
+ filename: 'fac.0.wasm',
+ name: null,
+ line: 1,
+ );
+ }
+
+ #[Depends('testModule0')]
+ public function testAssertReturn1(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'fac-rec', 'args' => [['type' => 'i64', 'value' => '25']]],
+ expected: [['type' => 'i64', 'value' => '7034535277573963776']],
+ line: 102,
+ );
+ }
+
+ #[Depends('testAssertReturn1')]
+ public function testAssertReturn2(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'fac-iter', 'args' => [['type' => 'i64', 'value' => '25']]],
+ expected: [['type' => 'i64', 'value' => '7034535277573963776']],
+ line: 103,
+ );
+ }
+
+ #[Depends('testAssertReturn2')]
+ public function testAssertReturn3(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'fac-rec-named', 'args' => [['type' => 'i64', 'value' => '25']]],
+ expected: [['type' => 'i64', 'value' => '7034535277573963776']],
+ line: 104,
+ );
+ }
+
+ #[Depends('testAssertReturn3')]
+ public function testAssertReturn4(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'fac-iter-named', 'args' => [['type' => 'i64', 'value' => '25']]],
+ expected: [['type' => 'i64', 'value' => '7034535277573963776']],
+ line: 105,
+ );
+ }
+
+ #[Depends('testAssertReturn4')]
+ public function testAssertReturn5(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'fac-opt', 'args' => [['type' => 'i64', 'value' => '25']]],
+ expected: [['type' => 'i64', 'value' => '7034535277573963776']],
+ line: 106,
+ );
+ }
+
+ #[Depends('testAssertReturn5')]
+ public function testAssertReturn6(): void
+ {
+ $this->runAssertReturnCommand(
+ module: null,
+ action: ['type' => 'invoke', 'field' => 'fac-ssa', 'args' => [['type' => 'i64', 'value' => '25']]],
+ expected: [['type' => 'i64', 'value' => '7034535277573963776']],
+ line: 107,
+ );
+ }
+
+ #[Depends('testAssertReturn6')]
+ public function testAssertExhaustion7(): void
+ {
+ $this->runAssertExhaustionCommand(
+ action: ['type' => 'invoke', 'field' => 'fac-rec', 'args' => [['type' => 'i64', 'value' => '1073741824']]],
+ text: 'call stack exhausted',
+ line: 109,
+ );
+ }
+}