aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-06-02 04:21:32 +0900
committernsfisis <nsfisis@gmail.com>2024-06-02 04:21:32 +0900
commit7c0ebc680e19398fdfd56d3a64f0c643ec07fbe0 (patch)
tree69ecc1ddfcb319e0137e373d531a2c7172012297 /tests/src
parenta2da9e5300e7dd819fd4e2d8af41cf440ed13c79 (diff)
downloadphp-waddiwasi-7c0ebc680e19398fdfd56d3a64f0c643ec07fbe0.tar.gz
php-waddiwasi-7c0ebc680e19398fdfd56d3a64f0c643ec07fbe0.tar.zst
php-waddiwasi-7c0ebc680e19398fdfd56d3a64f0c643ec07fbe0.zip
test: RefIsNullTest passed
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/SpecTestsuites/SpecTestsuiteBase.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/src/SpecTestsuites/SpecTestsuiteBase.php b/tests/src/SpecTestsuites/SpecTestsuiteBase.php
index 2fc1998..5b3f64f 100644
--- a/tests/src/SpecTestsuites/SpecTestsuiteBase.php
+++ b/tests/src/SpecTestsuites/SpecTestsuiteBase.php
@@ -13,6 +13,7 @@ use Nsfisis\Waddiwasi\Execution\StackOverflowException;
use Nsfisis\Waddiwasi\Execution\Store;
use Nsfisis\Waddiwasi\Execution\TrapException;
use Nsfisis\Waddiwasi\Execution\TrapKind;
+use Nsfisis\Waddiwasi\Structure\Types\RefType;
use PHPUnit\Framework\TestCase;
use RuntimeException;
use function count;
@@ -149,7 +150,7 @@ abstract class SpecTestsuiteBase extends TestCase
/**
* @param array{type: string, value: string} $arg
*/
- private static function wastValueToInternalValue(array $arg): int|float|RefExtern
+ private static function wastValueToInternalValue(array $arg): int|float|Ref
{
$type = $arg['type'];
$value = $arg['value'];
@@ -158,7 +159,8 @@ abstract class SpecTestsuiteBase extends TestCase
'i64' => unpack('q', self::convertInt64ToBinary($value))[1],
'f32' => unpack('g', pack('l', (int)$value))[1],
'f64' => unpack('e', self::convertInt64ToBinary($value))[1],
- 'externref' => Ref::RefExtern((int)$value),
+ 'externref' => $value === 'null' ? Ref::RefNull(RefType::ExternRef) : Ref::RefExtern((int)$value),
+ 'funcref' => $value === 'null' ? Ref::RefNull(RefType::FuncRef) : Ref::RefFunc((int)$value),
default => throw new RuntimeException("unknown type: $type"),
};
}