pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2014-12-04
2014-12-04 19:23:46 by Martin Nilsson <nilsson@opera.com>
84ca42df44fe0bf1ae4a30aedc6eeaf59e025fe6 (
936
lines) (+
455
/-
481
)
[
Show
|
Annotate
]
Branch:
bill/master_archive_support
Removed auto bignum checks.
7124:
Pike.count_memory (m, master()); return m->rounds; ]], 2)
-
cond([[has_value (cpp ("__AUTO_BIGNUM__"), "1")]], [[
+
test_true([[Pike.count_memory (-1, Int.NATIVE_MAX + 1) > Pike.count_memory (-1, 17)]]) test_true([[Pike.count_memory (-1, Int.NATIVE_MAX << 100) > Pike.count_memory (-1, Int.NATIVE_MAX + 1)]])
-
]])
+
test_do([[add_constant("count_memory_stats")]]) test_program([[
7165:
test_true([[1.0 <= 1]]) test_true([[1.0 >= 1]])
-
cond_begin([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]])
-
+
// Test the lexer. test_eq("2147483648", [[ (string)0x80000000 ]]) test_eq("2147483649", [[ (string)0x80000001 ]])
7197:
test_do([[ _next ((mixed) Int.NATIVE_MAX + 1) ]]) test_do([[ _next ((mixed) Int.NATIVE_MIN - 1) ]])
-
cond_end // __AUTO_BIGNUM__
-
+
// These numbers should be native integers. test_eval_error([[ _next ((mixed) -0x80000000) ]]) test_eval_error([[ _next ((mixed) -0x7fffffff) ]])
7206:
test_eval_error([[ _next ((mixed) Int.NATIVE_MAX) ]]) test_eval_error([[ _next ((mixed) Int.NATIVE_MIN) ]])
-
cond_begin([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]])
-
+
// Test incrementations (FIXME: More cases?). test_eq("2147483648", [[ (string)(class { int f(int x) { x++; return x; } })()->f(0x7fffffff) ]])
7569:
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)/Gmp.mpz(12884901888)]],5); test_eq([[Gmp.mpz(123456789012345678901234567890)/Gmp.mpz(12884901888)]], Gmp.mpz(9581507883061474724));
7578:
Gmp.mpz(67890123456789012345)]],1818479371); test_eq([[Gmp.mpz(123456789012345678901234567890)/ Gmp.mpz(67890123456789)]],Gmp.mpz(1818479371169857));
-
]] )
+
test_any([[int a=10->pow(30); int b=1000000000000000000000000000000; return ([a:1])[b]]],1);
7622:
array b=({j+13,j+11,j-1,j+8,j+16,j+15,j+12}); return sizeof( a-b )]],0);
-
cond_end // __AUTO_BIGNUM__
-
+
cond([[all_constants()->_verify_internals]], [[ test_do(_verify_internals())
10335:
test_equal(`+(([0:1,3:6]),([5:2,3:6])),([0:1,3:6,3:6,5:2])) test_equal(17+class{mixed ``+(mixed n){return (<n>);}}(),(<17>))
-
cond([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]],
-
[[
+
test_equal(1700000000000000000000+class{mixed ``+(mixed n){return (<n>);}}(),(<1700000000000000000000>))
-
]])
+
-
cond( [[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 && master()->resolv("Gmp")->mpz ]],
-
[[
+
test_eval_error(Gmp.mpz(1700000000000000000000)+class{mixed ``+(mixed n){return (<n>);}}())
-
]])
+
// - `- // - `->
13221:
test_eq([[ sprintf("%2c",2147483648) ]],"\0\0") test_eq([[ sprintf("%-2c",2147483648) ]],"\0\0")
-
cond([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]])
-
+
test_eq([[ sprintf("%1c", 0x1abcd7893) ]], "\223") test_eq([[ sprintf("%2c", 0x1abcd7893) ]], "x\223") test_eq([[ sprintf("%3c", 0x1abcd7893) ]], "\315x\223")
13251:
test_eq("\25363274223", [[ sprintf("%c", 0x1abcd7893) ]]) test_eq("\12414503555", [[ sprintf("%c", -0x1abcd7893) ]])
-
cond_end // __AUTO_BIGNUM__
-
+
test_eq([[ sprintf("%x", -1) ]], "-1") test_eq([[ sprintf("%4x", -1) ]], " -1") test_eq([[ sprintf("%10x", -1) ]], " -1")
13278:
test_eq("0001", [[ sprintf("%04.2x", 1) ]]) test_eq("00cc", [[ sprintf("%04.2x", -0x1234) ]])
-
cond_begin([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]])
-
+
test_eq("-123456789123456789", [[ sprintf("%x", -0x123456789123456789) ]]) test_eq("ba9877", [[ sprintf("%.6x", -0x123456789123456789) ]]) test_eq("876edcba9877", [[ sprintf("%.12x", -0x123456789123456789) ]]) test_eq(" 876edcba9877", [[ sprintf("%20.12x",-0x123456789123456789)]])
-
cond_end // __AUTO_BIGNUM__
-
+
test_eq("77777777760000000000", [[ sprintf("%.20o", -0x80000000) ]]) test_true(stringp(sprintf("")))