summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/builtins/Math/Math.log2.js
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/builtins/Math/Math.log2.js')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Math/Math.log2.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Math/Math.log2.js b/Userland/Libraries/LibJS/Tests/builtins/Math/Math.log2.js
new file mode 100644
index 0000000000..efa84a2377
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/Math/Math.log2.js
@@ -0,0 +1,10 @@
+test("basic functionality", () => {
+ expect(Math.log2).toHaveLength(1);
+
+ expect(Math.log2(3)).toBeCloseTo(1.584962500721156);
+ expect(Math.log2(2)).toBe(1);
+ expect(Math.log2(1)).toBe(0);
+ expect(Math.log2(0)).toBe(-Infinity);
+ expect(Math.log2(-2)).toBe(NaN);
+ expect(Math.log2(1024)).toBe(10);
+});