提交 b8272233 编写于 作者: 杜庆泉's avatar 杜庆泉

number equals 示例添加

上级 666ebe6a
......@@ -72,32 +72,63 @@ export function testNumber(): Result {
test('numberEquals', () => {
let a1 = 10.123
let b1 = 10.12300
let c1 = 10.12300002
expect(a1 == b1).toEqual(true);
expect(a1 === b1).toEqual(true);
expect(a1 !== 10.123001).toEqual(true);
expect(a1 != c1).toEqual(true);
let a2 = 0
let b2 = 0.0
expect(a2 == b2).toEqual(true);
expect(a2 === b2).toEqual(true);
let a3 = -1000
let b3 = -1000.0
expect(a3 == b3).toEqual(true);
expect(a3 === b3).toEqual(true);
let a4 = 123456789123456
let b4 = 123456789123456.0
expect(a4 == b4).toEqual(true);
expect(a4 === b4 * 1.0).toEqual(true);
let a5 = -123456789123456
let b5 = -123456789123456.01
expect(a5 == b5).toEqual(false);
expect(a5 != b5).toEqual(true);
expect(a5 !== b5).toEqual(true);
let a6 = 246.0 / 123 * 1.0
let b6 = 2
let c6 = 2.0
expect(a6 == b6).toEqual(true);
expect(b6 == c6).toEqual(true);
expect(b6 === c6).toEqual(true);
expect(b6 !== c6 * 1.001).toEqual(true);
expect(b6 != c6 * 1.001).toEqual(true);
let a7 = -10 * 123.2
let b7 = - 1232
expect(a7 == b7).toEqual(true);
expect(a7 != b7 * -1).toEqual(true);
let a8 = -101 * 123.201
expect(a8 == -12443.301).toEqual(true);
expect(a8 === -12443.301).toEqual(true);
expect(a8 !== -12443.301 * 0.999).toEqual(true);
expect(a8 != -12443.301 * 0.999999).toEqual(true);
let a9 = -0.02 * -123456
expect(a9 == 2469.12).toEqual(true);
expect(a9 === 2469.12).toEqual(true);
expect(a9 != 2469.1201).toEqual(true);
let a10 = 123456789123456.123456789123456
let b10 = 123456789123456.123456789123456000000
expect(a10 == b10).toEqual(true);
expect(a10 === b10).toEqual(true);
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册