log2-basicTests.js (1513B)
1 // Copyright 2015 Microsoft Corporation. All rights reserved. 2 // This code is governed by the license found in the LICENSE file. 3 4 /*--- 5 description: Math.Log2 with sample values. 6 es6id: 20.2.2.23 7 ---*/ 8 9 assert.sameValue(Math.log2(-0), Number.NEGATIVE_INFINITY, 10 "Math.log2 produces incorrect output for -0"); 11 assert.sameValue(Math.log2(+0), Number.NEGATIVE_INFINITY, 12 "Math.log2 produces incorrect output for +0"); 13 assert.sameValue(Math.log2(-0.9), NaN, 14 "Math.log2 produces incorrect output for -0.9"); 15 assert.sameValue(Math.log2(NaN), NaN, 16 "Math.log2 produces incorrect output for NaN"); 17 assert.sameValue(Math.log2(-10), NaN, 18 "Math.log2 produces incorrect output for -10"); 19 assert.sameValue(Math.log2(-Infinity), NaN, 20 "Math.log2 produces incorrect output for -Infinity"); 21 assert.sameValue(Math.log2(null), Number.NEGATIVE_INFINITY, 22 "Math.log2 produces incorrect output for null"); 23 assert.sameValue(Math.log2(undefined), NaN, 24 "Math.log2 produces incorrect output for undefined"); 25 assert.sameValue(Math.log2(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, 26 "Math.log2 produces incorrect output for Number.POSITIVE_INFINITY"); 27 assert.sameValue(Math.log2(1), 0, 28 "Math.log2 produces incorrect output for 1"); 29 assert.sameValue(Math.log2(2.00), 1, 30 "Math.log2 produces incorrect output for 2.00"); 31 assert.sameValue(Math.log2(4.00), 2, 32 "Math.log2 produces incorrect output for 4.00"); 33 assert.sameValue(Math.log2(8.00), 3, 34 "Math.log2 produces incorrect output for 8.00"); 35 36 reportCompare(0, 0);