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

增加64位整数的部分测试示例

上级 58084999
...@@ -21,6 +21,23 @@ export function testNumber(): Result { ...@@ -21,6 +21,23 @@ export function testNumber(): Result {
let obj = {"id":"3be2c600-894c-4231-aa56-82fd989cc961","result":{"result":[num1, num2, num3]}} let obj = {"id":"3be2c600-894c-4231-aa56-82fd989cc961","result":{"result":[num1, num2, num3]}}
console.log(JSON.stringify(obj)) console.log(JSON.stringify(obj))
expect(123456.789.toFixed(2)).toEqual("123456.79");
expect(12345600123.789123.toFixed(2)).toEqual("12345600123.79");
expect((-123456.789).toFixed(5)).toEqual("-123456.78900");
expect(parseFloat("16688995566.369").toFixed(3)).toEqual("16688995566.369");
// #ifndef APP-IOS
// android 专有数据类型
let a1 = 56
let a2 = -122
expect(a1.toByte().toFixed(2)).toEqual("56.00");
expect(a2.toByte().toFixed(2)).toEqual("-122.00");
expect(a1.toShort().toFixed(5)).toEqual("56.00000");
expect(a2.toShort().toFixed(5)).toEqual("-122.00000");
// #endif
}) })
test('isFinite', () => { test('isFinite', () => {
......
...@@ -47,6 +47,9 @@ export function testOperators(): Result { ...@@ -47,6 +47,9 @@ export function testOperators(): Result {
const a: number = 5; // 00000000000000000000000000000101 const a: number = 5; // 00000000000000000000000000000101
const b: number = 3; // 00000000000000000000000000000011 const b: number = 3; // 00000000000000000000000000000011
expect(a & b).toEqual(1); // 00000000000000000000000000000001 expect(a & b).toEqual(1); // 00000000000000000000000000000001
//expect(16677889900 & 10).toEqual(8);
//expect(888999555666 & 23.567).toEqual(18);
}) })
test('&=', () => { test('&=', () => {
let a = 5; // 00000000000000000000000000000101 let a = 5; // 00000000000000000000000000000101
...@@ -58,11 +61,14 @@ export function testOperators(): Result { ...@@ -58,11 +61,14 @@ export function testOperators(): Result {
const b: number = -3; // 11111111111111111111111111111101 const b: number = -3; // 11111111111111111111111111111101
expect(~a).toEqual(-6); // 11111111111111111111111111111010 expect(~a).toEqual(-6); // 11111111111111111111111111111010
expect(~b).toEqual(2); // 00000000000000000000000000000010 expect(~b).toEqual(2); // 00000000000000000000000000000010
}) })
test('|', () => { test('|', () => {
const a: number = 5; // 00000000000000000000000000000101 const a: number = 5; // 00000000000000000000000000000101
const b: number = 3; // 00000000000000000000000000000011 const b: number = 3; // 00000000000000000000000000000011
expect(a | b).toEqual(7); // 00000000000000000000000000000111 expect(a | b).toEqual(7); // 00000000000000000000000000000111
//expect(16677889901 | 10).toEqual(-501979281);
//expect(888999555661 | 23.567).toEqual(-58674593);
}) })
test('|=', () => { test('|=', () => {
let a = 5; // 00000000000000000000000000000101 let a = 5; // 00000000000000000000000000000101
...@@ -73,6 +79,8 @@ export function testOperators(): Result { ...@@ -73,6 +79,8 @@ export function testOperators(): Result {
const a: number = 5; // 00000000000000000000000000000101 const a: number = 5; // 00000000000000000000000000000101
const b: number = 3; // 00000000000000000000000000000011 const b: number = 3; // 00000000000000000000000000000011
expect(a ^ b).toEqual(6); // 00000000000000000000000000000110 expect(a ^ b).toEqual(6); // 00000000000000000000000000000110
//expect(16677889902 ^ 10).toEqual(-501979292);
//expect(888999555662 ^ 23.567).toEqual(-58674599);
}) })
test('^=', () => { test('^=', () => {
let a = 5; // 00000000000000000000000000000101 let a = 5; // 00000000000000000000000000000101
...@@ -256,6 +264,8 @@ export function testOperators(): Result { ...@@ -256,6 +264,8 @@ export function testOperators(): Result {
const c: number = -5; // 11111111111111111111111111111011 const c: number = -5; // 11111111111111111111111111111011
expect(a >> b).toEqual(1); // 00000000000000000000000000000001 expect(a >> b).toEqual(1); // 00000000000000000000000000000001
expect(c >> b).toEqual(-2); // 11111111111111111111111111111110 expect(c >> b).toEqual(-2); // 11111111111111111111111111111110
//expect(16677889900 >> 10).toEqual(-490215);
//expect(888999555666 >> 23.567).toEqual(-7);
}) })
test('>>=', () => { test('>>=', () => {
let a = 5; // 00000000000000000000000000000101 let a = 5; // 00000000000000000000000000000101
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册