local a = Integer(5) local b = Integer(3) local c = Integer(-12) local d = Integer("-54321") local e = Integer("99989999999999999989999999999999999999999999999999999999989999999999999999999999999998999999999999999999999999989999999998") local f = Integer("-1267650600228229401496703205376") local g = Integer(16) local h = Integer(8) local x = Integer(8) / Integer(5) local y = Integer(1) / Integer(12) local z = Integer(-7) / Integer(10) starttest("integer construction") testeq(a, 5) testeq(b, 3) testeq(c, -12) testeq(d, "-54321") testeq(e, "99989999999999999989999999999999999999999999999999999999989999999999999999999999999998999999999999999999999999989999999998") testeq(f, "-1267650600228229401496703205376") endtest() starttest("integer operations") testeq(-c, 12) testeq(a + b, 8) testeq(b - c, 15) testeq(d - d, 0) testeq(e + f, "99989999999999999989999999999999999999999999999999999999989999999999999999999999999998999998732349399771770598493296794622") testeq(a * c, -60) testeq(f * f, "1606938044258990275541962092341162602522202993782792835301376") testeq(e * f, "-126752383516820657842978847503263945985032967946239999999987323493997717705985032967944972349399771770598503296781947493995182404784576509143246593589248") testeq(a // b, 1) testeq(a % b, 2) testeq(f // d, "23336289836862896513258283") testeq(f % d, "-14533") testeq(e // -f, "78878201913048970415230130190415677050906625793723347950240237316957169209243093407705758276") testeq(e % -f, "1011644662020502370048160308222") testeq(c ^ a, -248832) testeq(d ^ a, "-472975648731213834575601") testeq(a == b, false) testeq(b < a, true) testeq(a <= a, true) testeq(f < d, true) testeq(e <= f, false) endtest() starttest("integer conversions") testeq(a / b, "5/3") testeq(g / c, "-4/3") testeq(c / b, -4) endtest() starttest("rational operations") testeq(-x, "-8/5") testeq(x + y, "101/60") testeq(z - y, "-47/60") testeq(x * z, "-28/25") testeq(x / y, "96/5") testeq(y