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

增加 Math.abs 和 除法 部分测试示例

上级 647d5d7c
......@@ -106,6 +106,14 @@ export function testMath() : Result {
expect(difference(3, 5)).toEqual(2);
expect(difference(5, 3)).toEqual(2);
expect(difference(1.23456, 7.89012)).toEqual(6.6555599999999995);
let utsNumber1 = JSON.parse("-160")! as Number
expect(Math.abs(utsNumber1)).toEqual(160);
let utsNumber2 = Math.abs(0) - 0.123456
expect(Math.abs(utsNumber2)).toEqual(0.123456);
})
test('acos', () => {
......
......@@ -123,6 +123,15 @@ export function testOperators(): Result {
expect(divide(16788990015, 5)).toEqualNumber(3357798003);
expectNumber(divide(16788990015, 10088990000)).toEqualDouble(1.6640902622561822);
let utsNum1 = JSON.parse("0.123456")! as Number
let utsNum2 = JSON.parse("0.123456")! as Number
let utsNum3 = utsNum1 / utsNum2
expect(utsNum3).toEqualNumber(1);
let utsNum4 = 0.030864 / utsNum2
expect(utsNum4).toEqualNumber(0.25);
})
test('/=', () => {
let a:number = 3;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册