The OpenD Programming Language

printx

Tests ***********************************

version(unittest)
@trusted
void
printx

Examples

Int128 tests

1 Int128 c = Int128(5, 6);
2 assert(c == c);
3 assert(c == +c);
4 assert(c == - -c);
5 assert(~c == Int128(~5, ~6));
6 ++c;
7 assert(c == Int128(5, 7));
8 assert(--c == Int128(5, 6));
9 assert(!!c);
10 assert(!Int128());
11 
12 assert(c + Int128(10, 20) == Int128(15, 26));
13 assert(c - Int128(1, 2)   == Int128(4, 4));
14 assert(c * Int128(100, 2) == Int128(610, 12));
15 assert(c / Int128(3, 2)   == Int128(0, 1));
16 assert(c % Int128(3, 2)   == Int128(2, 4));
17 assert((c & Int128(3, 2)) == Int128(1, 2));
18 assert((c | Int128(3, 2)) == Int128(7, 6));
19 assert((c ^ Int128(3, 2)) == Int128(6, 4));
20 
21 assert(c + 15   == Int128(5, 21));
22 assert(c - 15   == Int128(4, -9));
23 assert(c * 15   == Int128(75, 90));
24 assert(c / 15   == Int128(0, 6148914691236517205));
25 assert(c % 15   == Int128(0, 11));
26 assert((c & 15) == Int128(0, 6));
27 assert((c | 15) == Int128(5, 15));
28 assert((c ^ 15) == Int128(5, 9));
29 
30 assert(15 + c   == Int128(5, 21));
31 assert(15 - c   == Int128(-5, 9));
32 assert(15 * c   == Int128(75, 90));
33 assert(15 / c   == Int128(0, 0));
34 assert(15 % c   == Int128(0, 15));
35 assert((15 & c) == Int128(0, 6));
36 assert((15 | c) == Int128(5, 15));
37 assert((15 ^ c) == Int128(5, 9));
38 
39 assert(c << 1 == Int128(10, 12));
40 assert(-c >> 1 == Int128(-3, 9223372036854775805));
41 assert(-c >>> 1 == Int128(9223372036854775805, 9223372036854775805));
42 
43 assert((c += 1) == Int128(5, 7));
44 assert((c -= 1) == Int128(5, 6));
45 assert((c += Int128(0, 1)) == Int128(5, 7));
46 assert((c -= Int128(0, 1)) == Int128(5, 6));
47 assert((c *= 2) == Int128(10, 12));
48 assert((c /= 2) == Int128(5, 6));
49 assert((c %= 2) == Int128());
50 c += Int128(5, 6);
51 assert((c *= Int128(10, 20)) == Int128(160, 120));
52 assert((c /= Int128(10, 20)) == Int128(0, 15));
53 c += Int128(72, 0);
54 assert((c %= Int128(10, 20)) == Int128(1, -125));
55 assert((c &= Int128(3, 20)) == Int128(1, 0));
56 assert((c |= Int128(8, 2)) == Int128(9, 2));
57 assert((c ^= Int128(8, 2)) == Int128(1, 0));
58 c |= Int128(10, 5);
59 assert((c <<= 1) == Int128(11 * 2, 5 * 2));
60 assert((c >>>= 1) == Int128(11, 5));
61 c = Int128(long.min, long.min);
62 assert((c >>= 1) == Int128(long.min >> 1, cast(ulong) long.min >> 1));
63 
64 assert(-Int128.min == Int128.min);
65 assert(Int128.max + 1 == Int128.min);
66 
67 c = Int128(5, 6);
68 assert(c < Int128(6, 5));
69 assert(c > 10);
70 
71 c = Int128(-1UL);
72 assert(c == -1UL);
73 c = Int128(-1L);
74 assert(c == -1L);

Meta