mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 23:59:49 +00:00
LibJS: Add numeric literal parsing for different bases and exponents
This commit is contained in:
parent
b82a2239c6
commit
500f6d9e3a
Notes:
sideshowbarker
2024-07-19 07:53:33 +09:00
Author: https://github.com/sunverwerth
Commit: 500f6d9e3a
Pull-request: https://github.com/SerenityOS/serenity/pull/1646
Reviewed-by: https://github.com/linusg
4 changed files with 107 additions and 5 deletions
20
Libraries/LibJS/Tests/numeric-literals-basic.js
Normal file
20
Libraries/LibJS/Tests/numeric-literals-basic.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
try {
|
||||
assert(0xff === 255);
|
||||
assert(0XFF === 255);
|
||||
assert(0o10 === 8);
|
||||
assert(0O10 === 8);
|
||||
assert(0b10 === 2);
|
||||
assert(0B10 === 2);
|
||||
assert(1e3 === 1000);
|
||||
assert(1e+3 === 1000);
|
||||
assert(1e-3 === 0.001);
|
||||
assert(.1 === 0.1);
|
||||
assert(.1e1 === 1);
|
||||
assert(0.1e1 === 1);
|
||||
assert(.1e+1 === 1);
|
||||
assert(0.1e+1 === 1);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue