START_MARKER |
test_true([["$Id: testsuite.in,v 1.890 2010/02/09 12:30:24 grubba Exp $"]]); |
|
// This triggered a bug only if run sufficiently early. |
test_compile_any([[#pike 7.2]]) |
test_compile_any([[#pike 7.4]]) |
test_compile_any([[#pike 7.0]]) |
test_compile_any([[#pike 0.6]]) |
|
cond([[all_constants()->_verify_internals]], |
[[ |
test_do(_verify_internals()) |
]]); |
test_eq(1e1,10.0); |
test_eq(1E1,10.0); |
test_eq(1e+1,10.0); |
test_eq(1.1e1,11.0); |
test_eq(1e-1,0.1); |
test_eq('\x20',32); |
test_eq("\x20","\040"); |
test_eq("\d32","\x20"); |
test_eq('Å',"Å"[0]); |
test_eq('\7777',"\7777"[0]); |
test_eq('\77777777',"\77777777"[0]); |
test_eq("\x10000","\x10000"); |
test_eq(0x80000000-0x80000000, 0); |
test_eq(0xf0000000-0xf0000000, 0); |
test_eq(0x80000001-0x80000000, 1); |
test_eq(0x80000000-0x80000001,-1); |
test_eq(-2147483648*-1, -2147483648/-1); |
cond([[ 0x8000000000000000 ]], |
[[ |
test_eq(0x8000000000000000-0x8000000000000000, 0); |
test_eq(0xf000000000000000-0xf000000000000000, 0); |
test_eq(0x8000000000000001-0x8000000000000000, 1); |
test_eq(0x8000000000000000-0x8000000000000001,-1); |
test_eq(-9223372036854775808*-1, -9223372036854775808/-1); |
]]) |
test_true([[1.0e-40]]); |
test_eq([[#"foo |
bar"]],[["foo\nbar"]]); |
test_eq([[#"foo\ |
bar"]],[["foobar"]]); |
test_true([[stringp(#string "Makefile")]]); |
test_any([[class Bar { array(int) foo = ({}); }; |
class Foo { inherit Bar; array(int) foo = ({1}); }; |
return sizeof(Foo()->foo);]],1); |
|
test_eq([["(" + 0x7fffffff + ")"]], "(2147483647)") |
test_eq([["(" + -0x80000000 + ")"]], "(-2147483648)") |
cond(0x8000000000000000, [[ |
test_eq([["(" + 0x7fffffffffffffff + ")"]], "(9223372036854775807)") |
test_eq([["(" + -0x8000000000000000 + ")"]], "(-9223372036854775808)") |
]]) |
test_eq([["(" + Int.NATIVE_MAX + ")"]], [[sprintf ("(%d)", Int.NATIVE_MAX)]]) |
test_eq([["(" + Int.NATIVE_MIN + ")"]], [[sprintf ("(%d)", Int.NATIVE_MIN)]]) |
|
# __func__ |
test_eq(__func__, "a") |
test_eq("b", __func__) |
|
test_eq(8, 0b1000); |
test_eq(-8, -0b1000); |
test_eq(16, 0b10000); |
test_eq(-16, -0b10000); |
|
test_true(1e-100000000000000000000000000000000000000000000000000000000000<=1e-10000) |
test_true(1e-10000<=1e-1000) |
test_true(1e-1000<=1e-100) |
test_true(1e-100<=1e-10) |
test_true(1e-10<=1e-1) |
test_true(1e-1<=1e1) |
test_true(1e1<=1e10) |
test_true(1e10<=1e100) |
test_true(1e100<=1e1000) |
test_true(1e1000<=1e10000) |
test_true(1e10000<=1e100000000000000000000000000000000000000000000000000000000000) |
|
test_compile_warning('\3434523423423523423423423423') |
test_compile_warning("\3434523423423523423423423423") |
test_compile_warning("\d109827346981234561823743412654") |
test_compile_warning("\x109a27bc69e256c83deaa34c26b4") |
test_compile_error('\u17fo') |
test_compile_warning("\u17fo") |
test_compile_error('\uu117f') |
test_eq("\uuuu17fo", "\\uuu17fo") |
test_eq('\u117f', 0x117f) |
test_eq("\u117foo", "\10577oo") |
test_eq("\u1117foo", "\10427foo") |
test_eq("\uuuu117foo", "\\uuu117foo") |
test_compile_error('\U117f') |
test_compile_warning("\U117f") |
test_compile_warning("\UdEaDbEaT") |
test_eq("\UUdEaDbEaT", "\\UdEaDbEaT") |
test_eq('\UDeaDBeEF', -559038737) |
test_eq("\UDeaDBeEFFF", "\33653337357FF") |
test_eq("\UUDeaDBeEFFF", "\\UDeaDBeEFFF") |
test_any([[ |
// Suppress warnings. |
class handler { |
void compile_warning (string file, int line, string err) {}; |
}; |
return compile_string("string s = \"\\3434523423423523423423423423\";", |
"-", handler())()->s; |
]], "\37777777777") |
test_any([[ |
// Suppress warnings. |
class handler { |
void compile_warning (string file, int line, string err) {}; |
}; |
return compile_string("int i = '\\3434523423423523423423423423';", |
"-", handler())()->i; |
]], -1) |
|
test_do([[ |
// bug 2677 |
int x; |
if (time()) |
x = 1; |
else |
foo: break foo; |
]]) |
|
test_any([[ |
// bug 2690 |
array(function) foo(void|int b) |
{ |
int add() { return b++; }; |
return ({ add, add }); |
}; |
array(function) bar = foo(); |
return equal(({`==(@bar),@bar()}), ({ 1, 0, 1 })); |
]], 1) |
|
test_any([[ |
int f (int i) {i = 0; return i;}; |
return f (1); |
]],0) |
|
test_any([[ |
// Test that F_TAIL_RECUR and RECUR work pro |