pike.git
/
src
/
testsuite.in
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/testsuite.in:7117:
]], [["i:15,c:10,e:0,v:35,r:20,rnd:6"]]) test_true([[Pike.count_memory (Int.NATIVE_MAX, ({master()})) == Pike.count_memory (-1, ({0}))]]) test_any([[ mapping m = (["lookahead": Int.NATIVE_MAX, "block_programs": 0, "collect_stats": 1]); 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([[ function ff() { array x; array b() {return x;}; x = ({b}); return b; }
pike.git/src/testsuite.in:7158:
test_true([[Float.MIN_10_EXP <= -37]]) test_true([[Float.MAX_10_EXP >= 37]]) test_true([[Float.MIN <= 1e-37]]) test_true([[Float.MAX >= 1e37]]) test_true([[Float.EPSILON <= 1e-5]]) test_true([[1 <= 1.0]]) test_true([[1 >= 1.0]]) 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 ]]) test_eq("-2147483648", [[ (string)-0x80000000 ]]) test_eq("-2147483649", [[ (string)-0x80000001 ]]) test_eq("2147483648", [[ (string)-(-0x80000000) ]]) test_eq("2147483649", [[ (string)-(-0x80000001) ]]) test_eq("9223372036854775808", [[ (string)0x8000000000000000 ]]) test_eq("9223372036854775809", [[ (string)0x8000000000000001 ]]) test_eq("-9223372036854775808", [[ (string)-0x8000000000000000 ]])
pike.git/src/testsuite.in:7190:
test_eq("-1125899906842624", [[ (string)-0b100000000000000000000000000000000000000000000000000 ]]) test_eq(500000000 * 10, 5000000000) test_eq(5000000000000000000 * 10, 50000000000000000000) // Numbers that shouldn't be native integers. Has to resort to // strange methods to test this since bignums behave like native // integers in almost every way. 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) ]]) test_eval_error([[ _next ((mixed) 0x7fffffff) ]]) 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) ]]) test_eq("2147483648", [[ (string)(class { int f(int x) { ++x; return x; } })()->f(0x7fffffff) ]]) test_eq("2147483648", [[ (string)(class { int x=0x7fffffff;int f() { ++x;return x; } })()->f() ]]) test_eq("2147483648", [[ (string)(class { int x=0x7fffffff;int f() { x++;return x; } })()->f() ]]) test_eq("2147483648",
pike.git/src/testsuite.in:7562:
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)/Gmp.mpz(12884901888)]],5); test_eq([[Gmp.mpz(123456789012345678901234567890)/Gmp.mpz(12884901888)]], Gmp.mpz(9581507883061474724)); test_eq([[Gmp.mpz(123456789012345678901234567890)/ 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); test_any([[int a=10->pow(30); int b=1000000000000000000000000000000; return (<a>)[b]]],1); test_any([[int a=10->pow(30); int b=1000000000000000000000000000000; return sizeof( ({a})-({b}) )]],0); test_any([[int a=10->pow(30); int b=1000000000000000000000000000000; return sizeof( ({a})&({b}) )]],1); test_any([[int k=10->pow(30);
pike.git/src/testsuite.in:7615:
// now the bignum ones test_any([[int k=10->pow(30); int j=k+1; array a=({k+17,k+16,k+13,k+14,k+12,k,k+9}); array b=({j+16,j+15,j+12,j+13,j+11,j-1,j+8}); return sizeof( a&b )]],7); test_any([[int k=10->pow(30); int j=k+1; array a=({k+17,k+16,k+13,k+14,k+12,k,k+9}); 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()) ]]) test_eq("\377"[0],255) test_do(add_constant("foo",class c {int i;}())) test_eq(foo->i,0) test_do(foo->i=17) test_eq(foo->i,17)
pike.git/src/testsuite.in:10328:
test_eq(`+("humannumber",`+(666+111)),"humannumber777") test_eq(`+("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","x","y"),"abcdefghijklmnopqrstuvxy") test_eq(`+(1.0+1.0),2.0) test_eq(`+(1.0,-1.0),0.0) test_eq(`+(-1.0,-1.0),-2.0) test_equal(`+(({1,2,3}),({4,5,6})),({1,2,3,4,5,6})) test_equal(`+((<1,2,3,4>),(<4,5,6>)),(<1,2,3,4,4,5,6>)) 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>);}}())
-
]])
+
// - `- // - `-> // - `->= // - `/ // - `< // - `<< // - `<= // - `== // - `>
pike.git/src/testsuite.in:13214:
test_eq([[ sprintf("%4c",16909060) ]],"\1\2\3\4") test_eq([[ sprintf("%-4c",16909060) ]],"\4\3\2\1") test_eq([[ sprintf("%2c",16909060) ]],"\3\4") test_eq([[ sprintf("%-2c",16909060) ]],"\4\3") test_eq([[ sprintf("%4c",2147483648) ]],"\200\0\0\0") test_eq([[ sprintf("%-4c",2147483648) ]],"\0\0\0\200") 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") test_eq([[ sprintf("%4c", 0x1abcd7893) ]], "\253\315x\223") test_eq([[ sprintf("%5c", 0x1abcd7893) ]], "\1\253\315x\223") test_eq([[ sprintf("%6c", 0x1abcd7893) ]], "\0\1\253\315x\223") test_eq([[ sprintf("%7c", 0x1abcd7893) ]], "\0\0\1\253\315x\223") test_eq([[ sprintf("%1c", -0x1abcd7893) ]], "m") test_eq([[ sprintf("%2c", -0x1abcd7893) ]], "\207m")
pike.git/src/testsuite.in:13244:
test_eq([[ array_sscanf(sprintf("%6c", -1), "%6c")[0] ]], 281474976710655) test_eq([[ array_sscanf(sprintf("%7c", -1), "%7c")[0] ]], 72057594037927935) test_eq([[ array_sscanf(sprintf("%8c", -1), "%8c")[0] ]], 18446744073709551615) test_eq([[ array_sscanf(sprintf("%9c", -1), "%9c")[0] ]], 4722366482869645213695) test_eq([[ array_sscanf(sprintf("%10c", -1), "%10c")[0] ]], 1208925819614629174706175) test_eq([[ array_sscanf(sprintf("%11c", -1), "%11c")[0] ]], 309485009821345068724781055) 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") test_eq([[ sprintf("%10x", -15) ]], " -f") test_eq([[ sprintf("%010x", -15) ]], "-00000000f") test_eq([[ sprintf("%08x", -1) ]], "-0000001") test_eq([[ sprintf("%016x", -15) ]], "-00000000000000f") test_eq([[ sprintf("%x", 65535) ]], "ffff") test_eq([[ sprintf("%x", -0x80000000) ]], "-80000000")
pike.git/src/testsuite.in:13271:
test_eq("1", [[ sprintf("%.3x", 1) ]]) test_eq("1", [[ sprintf("%0.3x", 1) ]]) test_eq("fff", [[ sprintf("%0.3x", -1) ]]) test_eq("1", [[ sprintf("%0.16x", 1) ]]) test_eq("ffffffffffffffff", [[ sprintf("%0.16x", -1) ]]) test_eq(" ff", [[ sprintf("%4.2x", -1) ]]) test_eq("00ff", [[ sprintf("%04.2x", -1) ]]) 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(""))) test_true(sprintf("--real %1.20f --imaginary %1.20f --scale %1.20f\n",-0.9,-0.9,-0.9)) test_eq(sprintf("%%"),"%") test_eq(sprintf("%d",1),"1") test_eq(sprintf("%d",-1),"-1") test_eq(sprintf("%o",1),"1") test_eq(sprintf("%u",1<<31),"2147483648") test_false(sprintf("%u",-1)=="-1")