mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
Meta: Correctly parse numeric literals in wasm tests
This was previously parsing them as hex numbers, causing tests to fail. With this fix, 88% of the generated tests are passing :^)
This commit is contained in:
parent
bc936a5fac
commit
b2bd5132c4
Notes:
sideshowbarker
2024-07-18 17:19:52 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/b2bd5132c41 Pull-request: https://github.com/SerenityOS/serenity/pull/7482 Reviewed-by: https://github.com/ADKaster
1 changed files with 13 additions and 4 deletions
|
@ -126,7 +126,7 @@ def genarg(spec):
|
|||
return '-NaN'
|
||||
|
||||
try:
|
||||
x = float.fromhex(x)
|
||||
x = float(x)
|
||||
if math.isnan(x):
|
||||
# FIXME: This is going to mess up the different kinds of nan
|
||||
return '-NaN' if math.copysign(1.0, x) < 0 else 'NaN'
|
||||
|
@ -135,10 +135,19 @@ def genarg(spec):
|
|||
return str(x)
|
||||
except ValueError:
|
||||
try:
|
||||
x = int(x, 0)
|
||||
x = float.fromhex(x)
|
||||
if math.isnan(x):
|
||||
# FIXME: This is going to mess up the different kinds of nan
|
||||
return '-NaN' if math.copysign(1.0, x) < 0 else 'NaN'
|
||||
if math.isinf(x):
|
||||
return 'Infinity' if x > 0 else '-Infinity'
|
||||
return str(x)
|
||||
except ValueError:
|
||||
return x
|
||||
try:
|
||||
x = int(x, 0)
|
||||
return str(x)
|
||||
except ValueError:
|
||||
return x
|
||||
|
||||
x = gen()
|
||||
if x.startswith('nan'):
|
||||
|
@ -173,7 +182,7 @@ def genresult(ident, entry):
|
|||
|
||||
|
||||
def gentest(entry, main_name):
|
||||
name = entry["function"]["name"]
|
||||
name = json.dumps(entry["function"]["name"])[1:-1]
|
||||
if type(name) != str:
|
||||
print("Unsupported test case (call to", name, ")", file=stderr)
|
||||
return '\n '
|
||||
|
|
Loading…
Reference in a new issue