diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-11 03:50:50 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-11 04:14:03 +0900 |
| commit | 8a083ed74e9f4472441175e187208012927ed357 (patch) | |
| tree | 3686a0f61f3fccc5ded3eda28b92b8bf7765fd2f /tests | |
| parent | 26f49b7e27076e689541b9e13a1b54f60a4ee5c2 (diff) | |
| download | php-waddiwasi-8a083ed74e9f4472441175e187208012927ed357.tar.gz php-waddiwasi-8a083ed74e9f4472441175e187208012927ed357.tar.zst php-waddiwasi-8a083ed74e9f4472441175e187208012927ed357.zip | |
feat: simplify ValType structure
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/SpecTestsuites/SpecTestsuiteBase.php | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/tests/src/SpecTestsuites/SpecTestsuiteBase.php b/tests/src/SpecTestsuites/SpecTestsuiteBase.php index becd9de..bbc2d8e 100644 --- a/tests/src/SpecTestsuites/SpecTestsuiteBase.php +++ b/tests/src/SpecTestsuites/SpecTestsuiteBase.php @@ -24,8 +24,6 @@ use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\GlobalType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\Limits; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\MemType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\Mut; -use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\NumType; -use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\RefType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\TableType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ValType; use PHPUnit\Framework\TestCase; @@ -53,22 +51,22 @@ abstract class SpecTestsuiteBase extends TestCase $importObj = [ 'spectest' => [ 'memory' => Extern::Mem(new MemInst(new MemType(new Limits(1, 2)))), - 'table' => Extern::Table(new TableInst(new TableType(new Limits(10, 20), RefType::FuncRef), [ - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), - Ref::RefNull(RefType::FuncRef), + 'table' => Extern::Table(new TableInst(new TableType(new Limits(10, 20), ValType::FuncRef), [ + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), + Ref::RefNull(ValType::FuncRef), ])), - 'global_i32' => Extern::Global_(new GlobalInst(new GlobalType(Mut::Const, ValType::NumType(NumType::I32)), 666)), - 'global_i64' => Extern::Global_(new GlobalInst(new GlobalType(Mut::Const, ValType::NumType(NumType::I64)), 666)), - 'global_f32' => Extern::Global_(new GlobalInst(new GlobalType(Mut::Const, ValType::NumType(NumType::F32)), 666.6)), - 'global_f64' => Extern::Global_(new GlobalInst(new GlobalType(Mut::Const, ValType::NumType(NumType::F64)), 666.6)), + 'global_i32' => Extern::Global_(new GlobalInst(new GlobalType(Mut::Const, ValType::I32), 666)), + 'global_i64' => Extern::Global_(new GlobalInst(new GlobalType(Mut::Const, ValType::I64), 666)), + 'global_f32' => Extern::Global_(new GlobalInst(new GlobalType(Mut::Const, ValType::F32), 666.6)), + 'global_f64' => Extern::Global_(new GlobalInst(new GlobalType(Mut::Const, ValType::F64), 666.6)), ], ]; foreach (self::$registeredModules as $registeredModuleName => $registeredModule) { @@ -216,8 +214,8 @@ abstract class SpecTestsuiteBase extends TestCase 'nan:arithmetic' => NAN, default => unpack('e', self::convertInt64ToBinary($value))[1], }, - 'externref' => $value === 'null' ? Ref::RefNull(RefType::ExternRef) : Ref::RefExtern((int)$value), - 'funcref' => $value === 'null' ? Ref::RefNull(RefType::FuncRef) : Ref::RefFunc((int)$value), + 'externref' => $value === 'null' ? Ref::RefNull(ValType::ExternRef) : Ref::RefExtern((int)$value), + 'funcref' => $value === 'null' ? Ref::RefNull(ValType::FuncRef) : Ref::RefFunc((int)$value), default => throw new RuntimeException("unknown type: $type"), }; } |
