pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2004-02-17
2004-02-17 08:43:24 by Mirar (Pontus Hagland) <pike@sort.mirar.org>
2dc4c728ace46e14facf112787496d9a5c2e6283 (
87
lines) (+
86
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
some more long long int etc tests for bignum/mpz
Rev: src/testsuite.in:1.699
1:
-
test_true([["$Id: testsuite.in,v 1.
698
2004/02/
07
02
:
49
:
20
nilsson
Exp $"]]);
+
test_true([["$Id: testsuite.in,v 1.
699
2004/02/
17
08
:
43
:
24
mirar
Exp $"]]);
// This triggered a bug only if run sufficiently early. test_compile_any([[#pike 7.2]])
5894:
cond([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]], [[
+
test_eq([[(12)+(3)]],0xf);
+
test_eq([[(12)+(3*(1<<32))]],0x30000000c);
+
test_eq([[(12)+(3*(1<<64))]],0x3000000000000000c);
+
test_eq([[(12)+(3*(1<<128))]],0x30000000000000000000000000000000c);
+
test_eq([[(12*(1<<32))+(3)]],0xc00000003);
+
test_eq([[(12*(1<<32))+(3*(1<<32))]],0xf00000000);
+
test_eq([[(12*(1<<32))+(3*(1<<64))]],0x30000000c00000000);
+
test_eq([[(12*(1<<32))+(3*(1<<128))]],0x300000000000000000000000c00000000);
+
test_eq([[(12*(1<<64))+(3)]],0xc0000000000000003);
+
test_eq([[(12*(1<<64))+(3*(1<<32))]],0xc0000000300000000);
+
test_eq([[(12*(1<<64))+(3*(1<<64))]],0xf0000000000000000);
+
test_eq([[(12*(1<<64))+(3*(1<<128))]],0x3000000000000000c0000000000000000);
+
test_eq([[(12*(1<<128))+(3)]],0xc00000000000000000000000000000003);
+
test_eq([[(12*(1<<128))+(3*(1<<32))]],0xc00000000000000000000000300000000);
+
test_eq([[(12*(1<<128))+(3*(1<<64))]],0xc00000000000000030000000000000000);
+
test_eq([[(12*(1<<128))+(3*(1<<128))]],0xf00000000000000000000000000000000);
+
test_eq([[(12)-(3)]],0x9);
+
test_eq([[(12)-(3*(1<<32))]],-0x2fffffff4);
+
test_eq([[(12)-(3*(1<<64))]],-0x2fffffffffffffff4);
+
test_eq([[(12)-(3*(1<<128))]],-0x2fffffffffffffffffffffffffffffff4);
+
test_eq([[(12*(1<<32))-(3)]],0xbfffffffd);
+
test_eq([[(12*(1<<32))-(3*(1<<32))]],0x900000000);
+
test_eq([[(12*(1<<32))-(3*(1<<64))]],-0x2fffffff400000000);
+
test_eq([[(12*(1<<32))-(3*(1<<128))]],-0x2fffffffffffffffffffffff400000000);
+
test_eq([[(12*(1<<64))-(3)]],0xbfffffffffffffffd);
+
test_eq([[(12*(1<<64))-(3*(1<<32))]],0xbfffffffd00000000);
+
test_eq([[(12*(1<<64))-(3*(1<<64))]],0x90000000000000000);
+
test_eq([[(12*(1<<64))-(3*(1<<128))]],-0x2fffffffffffffff40000000000000000);
+
test_eq([[(12*(1<<128))-(3)]],0xbfffffffffffffffffffffffffffffffd);
+
test_eq([[(12*(1<<128))-(3*(1<<32))]],0xbfffffffffffffffffffffffd00000000);
+
test_eq([[(12*(1<<128))-(3*(1<<64))]],0xbfffffffffffffffd0000000000000000);
+
test_eq([[(12*(1<<128))-(3*(1<<128))]],0x900000000000000000000000000000000);
+
]])
+
+
cond([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]],
+
[[
+
test_eq([[(12)*(3)]],0x24);
+
test_eq([[(12)*(3*(1<<32))]],0x2400000000);
+
test_eq([[(12)*(3*(1<<64))]],0x240000000000000000);
+
test_eq([[(12)*(3*(1<<128))]],0x2400000000000000000000000000000000);
+
test_eq([[(12*(1<<32))*(3)]],0x2400000000);
+
test_eq([[(12*(1<<32))*(3*(1<<32))]],0x240000000000000000);
+
test_eq([[(12*(1<<32))*(3*(1<<64))]],0x24000000000000000000000000);
+
test_eq([[(12*(1<<32))*(3*(1<<128))]],0x240000000000000000000000000000000000000000);
+
test_eq([[(12*(1<<64))*(3)]],0x240000000000000000);
+
test_eq([[(12*(1<<64))*(3*(1<<32))]],0x24000000000000000000000000);
+
test_eq([[(12*(1<<64))*(3*(1<<64))]],0x2400000000000000000000000000000000);
+
test_eq([[(12*(1<<64))*(3*(1<<128))]],0x24000000000000000000000000000000000000000000000000);
+
test_eq([[(12*(1<<128))*(3)]],0x2400000000000000000000000000000000);
+
test_eq([[(12*(1<<128))*(3*(1<<32))]],0x240000000000000000000000000000000000000000);
+
test_eq([[(12*(1<<128))*(3*(1<<64))]],0x24000000000000000000000000000000000000000000000000);
+
test_eq([[(12*(1<<128))*(3*(1<<128))]],0x240000000000000000000000000000000000000000000000000000000000000000);
+
test_eq([[(12)/(3)]],0x4);
+
test_eq([[(12)/(3*(1<<32))]],0x0);
+
test_eq([[(12)/(3*(1<<64))]],0x0);
+
test_eq([[(12)/(3*(1<<128))]],0x0);
+
test_eq([[(12*(1<<32))/(3*(1<<32))]],0x4);
+
test_eq([[(12*(1<<32))/(3*(1<<64))]],0x0);
+
test_eq([[(12*(1<<32))/(3*(1<<128))]],0x0);
+
test_eq([[(12*(1<<64))/(3*(1<<64))]],0x4);
+
test_eq([[(12*(1<<64))/(3*(1<<128))]],0x0);
+
test_eq([[(12*(1<<128))/(3*(1<<128))]],0x4);
+
test_eq([[(17+12)%(3)]],0x2);
+
test_eq([[(17+12)%(3*(1<<32))]],0x1d);
+
test_eq([[(17+12)%(3*(1<<64))]],0x1d);
+
test_eq([[(17+12)%(3*(1<<128))]],0x1d);
+
test_eq([[(17+12*(1<<32))%(3*(1<<32))]],0x11);
+
test_eq([[(17+12*(1<<32))%(3*(1<<64))]],0xc00000011);
+
test_eq([[(17+12*(1<<32))%(3*(1<<128))]],0xc00000011);
+
test_eq([[(17+12*(1<<64))%(3*(1<<64))]],0x11);
+
test_eq([[(17+12*(1<<64))%(3*(1<<128))]],0xc0000000000000011);
+
test_eq([[(17+12*(1<<128))%(3*(1<<128))]],0x11);
+
+
cond( [[ master()->resolv("Gmp")->mpz ]],
+
[[
+
test_eq([[Gmp.mpz(68719476736)/12884901888]],5);
+
test_eq([[Gmp.mpz(123456789012345678901234567890)/12884901888]],9581507883061474724);
+
test_eq([[Gmp.mpz(123456789012345678901234567890)/67890123456789012345]],1818479371);
+
test_eq([[Gmp.mpz(123456789012345678901234567890)/67890123456789]],1818479371169857);
+
]] )
+
]])
+
+
cond([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]],
+
[[
test_any([[int a=10->pow(30); int b=1000000000000000000000000000000; return ([a:1])[b]]],1); test_any([[int a=10->pow(30); int b=1000000000000000000000000000000;