Debian Codegraph @

dojox/math/tests/BigInteger-ext.js

raw symbols SCIP
1 dojo.provide("dojox.math.tests.BigInteger-ext");
2
3 dojo.require("dojox.math.BigInteger-ext");
4
5 tests.register("dojox.math.tests.BigInteger-ext",
6 [
7 function sanity_check(t){
8 var x = new dojox.math.BigInteger("abcd1234", 16),
9 y = new dojox.math.BigInteger("beef", 16),
10 z = x.mod(y);
11 t.is("b60c", z.toString(16));
12 },
13 function constructor_array(t){
14 var x = new dojox.math.BigInteger([0, -1, -1, -1]);
15
16 t.is(1, x.t)
17 },
18 function constructor_base10(t){
19 var x = new dojox.math.BigInteger("10", 10);
20
21 t.is("10", x.toString(10))
22 },
23 function constructor_without_arg(t){
24 var x = new dojox.math.BigInteger("100");
25
26 t.is("100", x.toString())
27 },
28 function minus_one_num_bytes(t){
29 var x = new dojox.math.BigInteger("-1", 10);
30
31 t.is(1, x.t)
32 },
33 function compare_pl0(t){
34 var x = new dojox.math.BigInteger("18446744073709551616"),
35 y = new dojox.math.BigInteger("18446744073709551616"),
36 z = x.compareTo(y);
37
38 t.is("0", z);
39 },
40 function compare_pl1(t){
41 var x = new dojox.math.BigInteger("9223372036854775807"),
42 y = new dojox.math.BigInteger("9223372036854775808"),
43 z = x.compareTo(y);
44
45 t.is("-1", z);
46 },
47 function compare_pl2(t){
48 var x = new dojox.math.BigInteger("2147483647"),
49 y = new dojox.math.BigInteger("65535"),
50 z = x.compareTo(y);
51
52 t.is("1", z);
53 },
54 function compare_pl3(t){
55 var x = new dojox.math.BigInteger("65535"),
56 y = new dojox.math.BigInteger("2147483647"),
57 z = x.compareTo(y);
58
59 t.is("-1", z);
60 },
61 function compare_mi0(t){
62 var x = new dojox.math.BigInteger("-9223372036854775809"),
63 y = new dojox.math.BigInteger("-9223372036854775809"),
64 z = x.compareTo(y);
65
66 t.is("0", z);
67 },
68 function compare_mi1(t){
69 var x = new dojox.math.BigInteger("-9223372036854775808"),
70 y = new dojox.math.BigInteger("-9223372036854775809"),
71 z = x.compareTo(y);
72
73 t.is("1", z);
74 },
75 function compare_mi2(t){
76 var x = new dojox.math.BigInteger("-32768"),
77 y = new dojox.math.BigInteger("-9223372036854775808"),
78 z = x.compareTo(y);
79
80 t.is("1", z);
81 },
82 function compare_mi3(t){
83 var x = new dojox.math.BigInteger("-2147483648"),
84 y = new dojox.math.BigInteger("-32768"),
85 z = x.compareTo(y);
86
87 t.is("-1", z);
88 },
89 function compare_mi1_mi1(t){
90 var x = new dojox.math.BigInteger("-1"),
91 y = new dojox.math.BigInteger("-1"),
92 z = x.compareTo(y);
93
94 t.is("0", z);
95 },
96 function compare_mi1_mi2(t){
97 var x = new dojox.math.BigInteger("-1"),
98 y = new dojox.math.BigInteger("-2"),
99 z = x.compareTo(y);
100
101 t.is("1", z);
102 }
103 ,
104 function compare_mi2_mi1(t){
105 var x = new dojox.math.BigInteger("-2"),
106 y = new dojox.math.BigInteger("-1"),
107 z = x.compareTo(y);
108
109 t.is("-1", z);
110 }
111 ]
112 );