xref: /llvm-project/flang/unittests/Evaluate/integer.cpp (revision b98ad941a40c96c841bceb171725c925500fce6c)
1*ee5fa1f2SLuke Ireland #include "flang/Evaluate/integer.h"
2*ee5fa1f2SLuke Ireland #include "testing.h"
3*ee5fa1f2SLuke Ireland #include <cstdio>
4*ee5fa1f2SLuke Ireland #include <string>
5*ee5fa1f2SLuke Ireland 
6*ee5fa1f2SLuke Ireland using Fortran::evaluate::Ordering;
7*ee5fa1f2SLuke Ireland using Fortran::evaluate::value::Integer;
8*ee5fa1f2SLuke Ireland 
exhaustiveTesting()9*ee5fa1f2SLuke Ireland template <int BITS, typename INT = Integer<BITS>> void exhaustiveTesting() {
10*ee5fa1f2SLuke Ireland   std::uint64_t maxUnsignedValue{(std::uint64_t{1} << BITS) - 1};
11*ee5fa1f2SLuke Ireland   std::int64_t maxPositiveSignedValue{(std::int64_t{1} << (BITS - 1)) - 1};
12*ee5fa1f2SLuke Ireland   std::int64_t mostNegativeSignedValue{-(std::int64_t{1} << (BITS - 1))};
13*ee5fa1f2SLuke Ireland   char desc[64];
14*ee5fa1f2SLuke Ireland   std::snprintf(desc, sizeof desc,
15*ee5fa1f2SLuke Ireland       "BITS=%d, PARTBITS=%d, sizeof(Part)=%d, LE=%d", BITS, INT::partBits,
16*ee5fa1f2SLuke Ireland       static_cast<int>(sizeof(typename INT::Part)), INT::littleEndian);
17*ee5fa1f2SLuke Ireland 
18*ee5fa1f2SLuke Ireland   MATCH(BITS, INT::bits)(desc);
19*ee5fa1f2SLuke Ireland   MATCH(maxPositiveSignedValue, INT::HUGE().ToUInt64())(desc);
20*ee5fa1f2SLuke Ireland   INT zero;
21*ee5fa1f2SLuke Ireland   TEST(zero.IsZero())(desc);
22*ee5fa1f2SLuke Ireland   MATCH(0, zero.ToUInt64())(desc);
23*ee5fa1f2SLuke Ireland   MATCH(0, zero.ToInt64())(desc);
24*ee5fa1f2SLuke Ireland 
25*ee5fa1f2SLuke Ireland   for (std::uint64_t x{0}; x <= maxUnsignedValue; ++x) {
26*ee5fa1f2SLuke Ireland     unsigned long long ullx = x;
27*ee5fa1f2SLuke Ireland     INT a{x};
28*ee5fa1f2SLuke Ireland     MATCH(x, a.ToUInt64())(desc);
29*ee5fa1f2SLuke Ireland     INT copy{a};
30*ee5fa1f2SLuke Ireland     MATCH(x, copy.ToUInt64())(desc);
31*ee5fa1f2SLuke Ireland     copy = a;
32*ee5fa1f2SLuke Ireland     MATCH(x, copy.ToUInt64())(desc);
33*ee5fa1f2SLuke Ireland     MATCH(x == 0, a.IsZero())("%s, x=0x%llx", desc, x);
34*ee5fa1f2SLuke Ireland     char buffer[64];
35*ee5fa1f2SLuke Ireland     std::snprintf(buffer, sizeof buffer, "   %llu", ullx);
36*ee5fa1f2SLuke Ireland     const char *p{buffer};
37*ee5fa1f2SLuke Ireland     auto readcheck{INT::Read(p)};
38*ee5fa1f2SLuke Ireland     TEST(!readcheck.overflow)("%s, x=0x%llx", desc, x);
39*ee5fa1f2SLuke Ireland     MATCH(x, readcheck.value.ToUInt64())("%s, x=0x%llx", desc, x);
40*ee5fa1f2SLuke Ireland     TEST(!*p)("%s, x=0x%llx", desc, x);
41*ee5fa1f2SLuke Ireland     std::snprintf(buffer, sizeof buffer, "%llx", ullx);
42*ee5fa1f2SLuke Ireland     p = buffer;
43*ee5fa1f2SLuke Ireland     readcheck = INT::Read(p, 16);
44*ee5fa1f2SLuke Ireland     TEST(!readcheck.overflow)("%s, x=0x%llx", desc, x);
45*ee5fa1f2SLuke Ireland     MATCH(x, readcheck.value.ToUInt64())("%s, x=0x%llx", desc, x);
46*ee5fa1f2SLuke Ireland     TEST(!*p)("%s, x=0x%llx", desc, x);
47*ee5fa1f2SLuke Ireland     std::string udec{a.UnsignedDecimal()};
48*ee5fa1f2SLuke Ireland     p = udec.data();
49*ee5fa1f2SLuke Ireland     readcheck = INT::Read(p);
50*ee5fa1f2SLuke Ireland     TEST(!readcheck.overflow)("%s, x=0x%llx", desc, x);
51*ee5fa1f2SLuke Ireland     MATCH(x, readcheck.value.ToUInt64())("%s, x=0x%llx", desc, x);
52*ee5fa1f2SLuke Ireland     TEST(!*p)("%s, x=0x%llx", desc, x);
53*ee5fa1f2SLuke Ireland     std::string hex{a.Hexadecimal()};
54*ee5fa1f2SLuke Ireland     p = hex.data();
55*ee5fa1f2SLuke Ireland     readcheck = INT::Read(p, 16);
56*ee5fa1f2SLuke Ireland     TEST(!readcheck.overflow)("%s, x=0x%llx", desc, x);
57*ee5fa1f2SLuke Ireland     MATCH(x, readcheck.value.ToUInt64())("%s, x=0x%llx", desc, x);
58*ee5fa1f2SLuke Ireland     TEST(!*p)("%s, x=0x%llx", desc, x);
59*ee5fa1f2SLuke Ireland     INT t{a.NOT()};
60*ee5fa1f2SLuke Ireland     MATCH(x ^ maxUnsignedValue, t.ToUInt64())("%s, x=0x%llx", desc, x);
61*ee5fa1f2SLuke Ireland     auto negated{a.Negate()};
62*ee5fa1f2SLuke Ireland     MATCH(x == std::uint64_t{1} << (BITS - 1), negated.overflow)
63*ee5fa1f2SLuke Ireland     ("%s, x=0x%llx", desc, x);
64*ee5fa1f2SLuke Ireland     MATCH(-x & maxUnsignedValue, negated.value.ToUInt64())
65*ee5fa1f2SLuke Ireland     ("%s, x=0x%llx", desc, x);
66*ee5fa1f2SLuke Ireland     auto abs{a.ABS()};
67*ee5fa1f2SLuke Ireland     MATCH(x == std::uint64_t{1} << (BITS - 1), abs.overflow)
68*ee5fa1f2SLuke Ireland     ("%s, x=0x%llx", desc, x);
69*ee5fa1f2SLuke Ireland     MATCH(x >> (BITS - 1) ? -x & maxUnsignedValue : x, abs.value.ToUInt64())
70*ee5fa1f2SLuke Ireland     ("%s, x=0x%llx", desc, x);
71*ee5fa1f2SLuke Ireland     int lzbc{a.LEADZ()};
72*ee5fa1f2SLuke Ireland     COMPARE(lzbc, >=, 0)("%s, x=0x%llx", desc, x);
73*ee5fa1f2SLuke Ireland     COMPARE(lzbc, <=, BITS)("%s, x=0x%llx", desc, x);
74*ee5fa1f2SLuke Ireland     MATCH(x == 0, lzbc == BITS)("%s, x=0x%llx, lzbc=%d", desc, x, lzbc);
75*ee5fa1f2SLuke Ireland     std::uint64_t lzcheck{std::uint64_t{1} << (BITS - lzbc)};
76*ee5fa1f2SLuke Ireland     COMPARE(x, <, lzcheck)("%s, x=0x%llx, lzbc=%d", desc, x, lzbc);
77*ee5fa1f2SLuke Ireland     COMPARE(x + x + !x, >=, lzcheck)("%s, x=0x%llx, lzbc=%d", desc, x, lzbc);
78*ee5fa1f2SLuke Ireland     int popcheck{0};
79*ee5fa1f2SLuke Ireland     for (int j{0}; j < BITS; ++j) {
80*ee5fa1f2SLuke Ireland       popcheck += (x >> j) & 1;
81*ee5fa1f2SLuke Ireland     }
82*ee5fa1f2SLuke Ireland     MATCH(popcheck, a.POPCNT())("%s, x=0x%llx", desc, x);
83*ee5fa1f2SLuke Ireland     MATCH(popcheck & 1, a.POPPAR())("%s, x=0x%llx", desc, x);
84*ee5fa1f2SLuke Ireland     int trailcheck{0};
85*ee5fa1f2SLuke Ireland     for (; trailcheck < BITS; ++trailcheck) {
86*ee5fa1f2SLuke Ireland       if ((x >> trailcheck) & 1) {
87*ee5fa1f2SLuke Ireland         break;
88*ee5fa1f2SLuke Ireland       }
89*ee5fa1f2SLuke Ireland     }
90*ee5fa1f2SLuke Ireland     MATCH(trailcheck, a.TRAILZ())("%s, x=0x%llx", desc, x);
91*ee5fa1f2SLuke Ireland     for (int j{0}; j < BITS; ++j) {
92*ee5fa1f2SLuke Ireland       MATCH((x >> j) & 1, a.BTEST(j))
93*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, bit %d", desc, x, j);
94*ee5fa1f2SLuke Ireland     }
95*ee5fa1f2SLuke Ireland     // TODO test DIM, MODULO, ISHFTC, DSHIFTL/R
96*ee5fa1f2SLuke Ireland     // TODO test IBCLR, IBSET, IBITS, MAX, MIN, MERGE_BITS, RANGE, SIGN
97*ee5fa1f2SLuke Ireland 
98*ee5fa1f2SLuke Ireland     Ordering ord{Ordering::Equal};
99*ee5fa1f2SLuke Ireland     std::int64_t sx = x;
100*ee5fa1f2SLuke Ireland     if (x + x > maxUnsignedValue) {
101*ee5fa1f2SLuke Ireland       TEST(a.IsNegative())("%s, x=0x%llx", desc, x);
102*ee5fa1f2SLuke Ireland       sx = x | (~std::uint64_t{0} << BITS);
103*ee5fa1f2SLuke Ireland       TEST(sx < 0)("%s, x=0x%llx %lld", desc, x, sx);
104*ee5fa1f2SLuke Ireland       ord = Ordering::Less;
105*ee5fa1f2SLuke Ireland     } else {
106*ee5fa1f2SLuke Ireland       TEST(!a.IsNegative())("%s, x=0x%llx", desc, x);
107*ee5fa1f2SLuke Ireland       TEST(sx >= 0)("%s, x=0x%llx %lld", desc, x, sx);
108*ee5fa1f2SLuke Ireland       if (sx > 0) {
109*ee5fa1f2SLuke Ireland         ord = Ordering::Greater;
110*ee5fa1f2SLuke Ireland       } else {
111*ee5fa1f2SLuke Ireland         ord = Ordering::Equal;
112*ee5fa1f2SLuke Ireland       }
113*ee5fa1f2SLuke Ireland     }
114*ee5fa1f2SLuke Ireland 
115*ee5fa1f2SLuke Ireland     TEST(sx == a.ToInt64())("%s, x=0x%llx %lld", desc, x, sx);
116*ee5fa1f2SLuke Ireland     TEST(a.CompareToZeroSigned() == ord)("%s, x=0x%llx %lld", desc, x, sx);
117*ee5fa1f2SLuke Ireland     for (int count{0}; count <= BITS + 1; ++count) {
118*ee5fa1f2SLuke Ireland       t = a.SHIFTL(count);
119*ee5fa1f2SLuke Ireland       MATCH((x << count) & maxUnsignedValue, t.ToUInt64())
120*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, count=%d", desc, x, count);
121*ee5fa1f2SLuke Ireland       t = a.ISHFT(count);
122*ee5fa1f2SLuke Ireland       MATCH((x << count) & maxUnsignedValue, t.ToUInt64())
123*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, count=%d", desc, x, count);
124*ee5fa1f2SLuke Ireland       t = a.SHIFTR(count);
125*ee5fa1f2SLuke Ireland       MATCH(x >> count, t.ToUInt64())
126*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, count=%d", desc, x, count);
127*ee5fa1f2SLuke Ireland       t = a.ISHFT(-count);
128*ee5fa1f2SLuke Ireland       MATCH(x >> count, t.ToUInt64())("%s, x=0x%llx, count=%d", desc, x, count);
129*ee5fa1f2SLuke Ireland       t = a.SHIFTA(count);
130*ee5fa1f2SLuke Ireland       std::uint64_t fill{-(x >> (BITS - 1))};
131*ee5fa1f2SLuke Ireland       std::uint64_t sra{
132*ee5fa1f2SLuke Ireland           count >= BITS ? fill : (x >> count) | (fill << (BITS - count))};
133*ee5fa1f2SLuke Ireland       MATCH(sra, t.ToInt64())
134*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, count=%d", desc, x, count);
135*ee5fa1f2SLuke Ireland     }
136*ee5fa1f2SLuke Ireland 
137*ee5fa1f2SLuke Ireland     for (std::uint64_t y{0}; y <= maxUnsignedValue; ++y) {
138*ee5fa1f2SLuke Ireland       std::int64_t sy = y;
139*ee5fa1f2SLuke Ireland       if (y + y > maxUnsignedValue) {
140*ee5fa1f2SLuke Ireland         sy = y | (~std::uint64_t{0} << BITS);
141*ee5fa1f2SLuke Ireland       }
142*ee5fa1f2SLuke Ireland       INT b{y};
143*ee5fa1f2SLuke Ireland       if (x < y) {
144*ee5fa1f2SLuke Ireland         ord = Ordering::Less;
145*ee5fa1f2SLuke Ireland       } else if (x > y) {
146*ee5fa1f2SLuke Ireland         ord = Ordering::Greater;
147*ee5fa1f2SLuke Ireland       } else {
148*ee5fa1f2SLuke Ireland         ord = Ordering::Equal;
149*ee5fa1f2SLuke Ireland       }
150*ee5fa1f2SLuke Ireland       TEST(a.CompareUnsigned(b) == ord)("%s, x=0x%llx, y=0x%llx", desc, x, y);
151*ee5fa1f2SLuke Ireland       MATCH(x >= y, a.BGE(b))("%s, x=0x%llx, y=0x%llx", desc, x, y);
152*ee5fa1f2SLuke Ireland       MATCH(x > y, a.BGT(b))("%s, x=0x%llx, y=0x%llx", desc, x, y);
153*ee5fa1f2SLuke Ireland       MATCH(x <= y, a.BLE(b))("%s, x=0x%llx, y=0x%llx", desc, x, y);
154*ee5fa1f2SLuke Ireland       MATCH(x < y, a.BLT(b))("%s, x=0x%llx, y=0x%llx", desc, x, y);
155*ee5fa1f2SLuke Ireland       if (sx < sy) {
156*ee5fa1f2SLuke Ireland         ord = Ordering::Less;
157*ee5fa1f2SLuke Ireland       } else if (sx > sy) {
158*ee5fa1f2SLuke Ireland         ord = Ordering::Greater;
159*ee5fa1f2SLuke Ireland       } else {
160*ee5fa1f2SLuke Ireland         ord = Ordering::Equal;
161*ee5fa1f2SLuke Ireland       }
162*ee5fa1f2SLuke Ireland       TEST(a.CompareSigned(b) == ord)
163*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx %lld %d, y=0x%llx %lld %d", desc, x, sx, a.IsNegative(), y,
164*ee5fa1f2SLuke Ireland           sy, b.IsNegative());
165*ee5fa1f2SLuke Ireland 
166*ee5fa1f2SLuke Ireland       t = a.IAND(b);
167*ee5fa1f2SLuke Ireland       MATCH(x & y, t.ToUInt64())("%s, x=0x%llx, y=0x%llx", desc, x, y);
168*ee5fa1f2SLuke Ireland       t = a.IOR(b);
169*ee5fa1f2SLuke Ireland       MATCH(x | y, t.ToUInt64())("%s, x=0x%llx, y=0x%llx", desc, x, y);
170*ee5fa1f2SLuke Ireland       t = a.IEOR(b);
171*ee5fa1f2SLuke Ireland       MATCH(x ^ y, t.ToUInt64())("%s, x=0x%llx, y=0x%llx", desc, x, y);
172*ee5fa1f2SLuke Ireland       auto sum{a.AddUnsigned(b)};
173*ee5fa1f2SLuke Ireland       COMPARE(
174*ee5fa1f2SLuke Ireland           x + y, ==, sum.value.ToUInt64() + (std::uint64_t{sum.carry} << BITS))
175*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, y=0x%llx, carry=%d", desc, x, y, sum.carry);
176*ee5fa1f2SLuke Ireland       auto ssum{a.AddSigned(b)};
177*ee5fa1f2SLuke Ireland       MATCH((sx + sy) & maxUnsignedValue, ssum.value.ToUInt64())
178*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, y=0x%llx", desc, x, y);
179*ee5fa1f2SLuke Ireland       MATCH(
180*ee5fa1f2SLuke Ireland           sx + sy < mostNegativeSignedValue || sx + sy > maxPositiveSignedValue,
181*ee5fa1f2SLuke Ireland           ssum.overflow)
182*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, y=0x%llx", desc, x, y);
183*ee5fa1f2SLuke Ireland       auto diff{a.SubtractSigned(b)};
184*ee5fa1f2SLuke Ireland       MATCH((sx - sy) & maxUnsignedValue, diff.value.ToUInt64())
185*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, y=0x%llx", desc, x, y);
186*ee5fa1f2SLuke Ireland       MATCH(
187*ee5fa1f2SLuke Ireland           sx - sy < mostNegativeSignedValue || sx - sy > maxPositiveSignedValue,
188*ee5fa1f2SLuke Ireland           diff.overflow)
189*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, y=0x%llx", desc, x, y);
190*ee5fa1f2SLuke Ireland       auto product{a.MultiplyUnsigned(b)};
191*ee5fa1f2SLuke Ireland       MATCH(
192*ee5fa1f2SLuke Ireland           x * y, (product.upper.ToUInt64() << BITS) ^ product.lower.ToUInt64())
193*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, y=0x%llx, lower=0x%llx, upper=0x%llx", desc, x, y,
194*ee5fa1f2SLuke Ireland           product.lower.ToUInt64(), product.upper.ToUInt64());
195*ee5fa1f2SLuke Ireland       product = a.MultiplySigned(b);
196*ee5fa1f2SLuke Ireland       MATCH((sx * sy) & maxUnsignedValue, product.lower.ToUInt64())
197*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, y=0x%llx", desc, x, y);
198*ee5fa1f2SLuke Ireland       MATCH(((sx * sy) >> BITS) & maxUnsignedValue, product.upper.ToUInt64())
199*ee5fa1f2SLuke Ireland       ("%s, x=0x%llx, y=0x%llx", desc, x, y);
200*ee5fa1f2SLuke Ireland       auto quot{a.DivideUnsigned(b)};
201*ee5fa1f2SLuke Ireland       MATCH(y == 0, quot.divisionByZero)("%s, x=0x%llx, y=0x%llx", desc, x, y);
202*ee5fa1f2SLuke Ireland       if (y == 0) {
203*ee5fa1f2SLuke Ireland         MATCH(maxUnsignedValue, quot.quotient.ToUInt64())
204*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx, y=0x%llx", desc, x, y);
205*ee5fa1f2SLuke Ireland         MATCH(0, quot.remainder.ToUInt64())
206*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx, y=0x%llx", desc, x, y);
207*ee5fa1f2SLuke Ireland       } else {
208*ee5fa1f2SLuke Ireland         MATCH(x / y, quot.quotient.ToUInt64())
209*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx, y=0x%llx", desc, x, y);
210*ee5fa1f2SLuke Ireland         MATCH(x % y, quot.remainder.ToUInt64())
211*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx, y=0x%llx", desc, x, y);
212*ee5fa1f2SLuke Ireland       }
213*ee5fa1f2SLuke Ireland       quot = a.DivideSigned(b);
214*ee5fa1f2SLuke Ireland       bool badCase{sx == mostNegativeSignedValue &&
215*ee5fa1f2SLuke Ireland           ((sy == -1 && sx != sy) || (BITS == 1 && sx == sy))};
216*ee5fa1f2SLuke Ireland       MATCH(y == 0, quot.divisionByZero)("%s, x=0x%llx, y=0x%llx", desc, x, y);
217*ee5fa1f2SLuke Ireland       MATCH(badCase, quot.overflow)("%s, x=0x%llx, y=0x%llx", desc, x, y);
218*ee5fa1f2SLuke Ireland       if (y == 0) {
219*ee5fa1f2SLuke Ireland         if (sx >= 0) {
220*ee5fa1f2SLuke Ireland           MATCH(maxPositiveSignedValue, quot.quotient.ToInt64())
221*ee5fa1f2SLuke Ireland           ("%s, x=0x%llx, y=0x%llx", desc, x, y);
222*ee5fa1f2SLuke Ireland         } else {
223*ee5fa1f2SLuke Ireland           MATCH(mostNegativeSignedValue, quot.quotient.ToInt64())
224*ee5fa1f2SLuke Ireland           ("%s, x=0x%llx, y=0x%llx", desc, x, y);
225*ee5fa1f2SLuke Ireland         }
226*ee5fa1f2SLuke Ireland         MATCH(0, quot.remainder.ToUInt64())
227*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx, y=0x%llx", desc, x, y);
228*ee5fa1f2SLuke Ireland       } else if (badCase) {
229*ee5fa1f2SLuke Ireland         MATCH(x, quot.quotient.ToUInt64())
230*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx, y=0x%llx", desc, x, y);
231*ee5fa1f2SLuke Ireland         MATCH(0, quot.remainder.ToUInt64())
232*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx, y=0x%llx", desc, x, y);
233*ee5fa1f2SLuke Ireland       } else {
234*ee5fa1f2SLuke Ireland         MATCH(sx / sy, quot.quotient.ToInt64())
235*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx %lld, y=0x%llx %lld; unsigned 0x%llx", desc, x, sx, y,
236*ee5fa1f2SLuke Ireland             sy, quot.quotient.ToUInt64());
237*ee5fa1f2SLuke Ireland         MATCH(sx - sy * (sx / sy), quot.remainder.ToInt64())
238*ee5fa1f2SLuke Ireland         ("%s, x=0x%llx, y=0x%llx", desc, x, y);
239*ee5fa1f2SLuke Ireland       }
240*ee5fa1f2SLuke Ireland     }
241*ee5fa1f2SLuke Ireland   }
242*ee5fa1f2SLuke Ireland }
243*ee5fa1f2SLuke Ireland 
main()244*ee5fa1f2SLuke Ireland int main() {
245*ee5fa1f2SLuke Ireland   TEST(Reverse(Ordering::Less) == Ordering::Greater);
246*ee5fa1f2SLuke Ireland   TEST(Reverse(Ordering::Greater) == Ordering::Less);
247*ee5fa1f2SLuke Ireland   TEST(Reverse(Ordering::Equal) == Ordering::Equal);
248*ee5fa1f2SLuke Ireland   TEST(Integer<128>{123456789}.UnsignedDecimal() == "123456789");
249*ee5fa1f2SLuke Ireland   TEST(Integer<128>{123456789}.SignedDecimal() == "123456789");
250*ee5fa1f2SLuke Ireland   TEST(Integer<128>{-123456789}.SignedDecimal() == "-123456789");
251*ee5fa1f2SLuke Ireland   std::uint64_t big{0x123456789abcdef};
252*ee5fa1f2SLuke Ireland   TEST(Integer<128>{big}.Hexadecimal() == "123456789abcdef");
253*ee5fa1f2SLuke Ireland   exhaustiveTesting<1>();
254*ee5fa1f2SLuke Ireland   exhaustiveTesting<2>();
255*ee5fa1f2SLuke Ireland   exhaustiveTesting<7>();
256*ee5fa1f2SLuke Ireland   exhaustiveTesting<8>();
257*ee5fa1f2SLuke Ireland   exhaustiveTesting<9>();
258*ee5fa1f2SLuke Ireland   exhaustiveTesting<9, Integer<9, true, 1>>();
259*ee5fa1f2SLuke Ireland   exhaustiveTesting<9, Integer<9, true, 1, std::uint8_t, std::uint16_t>>();
260*ee5fa1f2SLuke Ireland   exhaustiveTesting<9, Integer<9, true, 2>>();
261*ee5fa1f2SLuke Ireland   exhaustiveTesting<9, Integer<9, true, 2, std::uint8_t, std::uint16_t>>();
262*ee5fa1f2SLuke Ireland   exhaustiveTesting<9, Integer<9, true, 8, std::uint8_t, std::uint16_t>>();
263*ee5fa1f2SLuke Ireland   exhaustiveTesting<9, Integer<9, false, 8, std::uint8_t, std::uint16_t>>();
264*ee5fa1f2SLuke Ireland   return testing::Complete();
265*ee5fa1f2SLuke Ireland }
266