mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibJS: Add tests for bitwise NOT operator
This commit is contained in:
parent
9fca86109b
commit
7b2fdd08ce
Notes:
sideshowbarker
2024-07-18 23:59:56 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/7b2fdd08cec Pull-request: https://github.com/SerenityOS/serenity/pull/4869
1 changed files with 23 additions and 0 deletions
23
Libraries/LibJS/Tests/operators/bitwise-not.js
Normal file
23
Libraries/LibJS/Tests/operators/bitwise-not.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
test("basic functionality", () => {
|
||||
expect(~0).toBe(-1);
|
||||
expect(~1).toBe(-2);
|
||||
expect(~2).toBe(-3);
|
||||
expect(~3).toBe(-4);
|
||||
expect(~4).toBe(-5);
|
||||
expect(~5).toBe(-6);
|
||||
expect(~-1).toBe(0);
|
||||
expect(~42).toBe(-43);
|
||||
expect(~9999).toBe(-10000);
|
||||
});
|
||||
|
||||
test("non-numeric values", () => {
|
||||
expect(~"42").toBe(-43);
|
||||
expect(~"foo").toBe(-1);
|
||||
expect(~[]).toBe(-1);
|
||||
expect(~{}).toBe(-1);
|
||||
expect(~undefined).toBe(-1);
|
||||
expect(~null).toBe(-1);
|
||||
expect(~NaN).toBe(-1);
|
||||
expect(~Infinity).toBe(-1);
|
||||
expect(~-Infinity).toBe(-1);
|
||||
});
|
Loading…
Add table
Reference in a new issue