diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-08-30 16:20:53 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-30 22:47:02 +0200 |
commit | e93c740df5fe50a83b145e58c105ba54aaf67ac6 (patch) | |
tree | 10dbe7d9606b845cd319ff3a8538c406dfbb3b22 /Meta | |
parent | 99199b9bfdd40a94146bd43014ded6d9b14fca62 (diff) | |
download | serenity-e93c740df5fe50a83b145e58c105ba54aaf67ac6.zip |
Meta: Generate bigints for i64 values in LibWasm test suite files
Diffstat (limited to 'Meta')
-rw-r--r-- | Meta/generate-libwasm-spec-test.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Meta/generate-libwasm-spec-test.py b/Meta/generate-libwasm-spec-test.py index fffdc09280..991f13c37f 100644 --- a/Meta/generate-libwasm-spec-test.py +++ b/Meta/generate-libwasm-spec-test.py @@ -245,7 +245,10 @@ def genarg(spec): return str(struct.unpack('>i', struct.pack('>Q', int(x, 16))[4:])[0]) # cast back to i64 to get the correct sign - return str(struct.unpack('>q', struct.pack('>Q', int(x, 16)))[0]) + return str(struct.unpack('>q', struct.pack('>Q', int(x, 16)))[0]) + 'n' + if spec['type'] == 'i64': + # Make a bigint instead, since `double' cannot fit all i64 values. + return x + 'n' return x if x == 'nan': @@ -304,8 +307,8 @@ def genresult(ident, entry): if entry['kind'] == 'return': return ( - f'let {ident}_result = {expectation};\n ' + - (f'expect({ident}_result).toBe({genarg(entry["result"])})\n ' if entry["result"] is not None else '') + f'let {ident}_result = {expectation};\n ' + + (f'expect({ident}_result).toBe({genarg(entry["result"])})\n ' if entry["result"] is not None else '') ) if entry['kind'] == 'trap': |