1169d9 | 2004-05-02 | Martin Nilsson | | START_MARKER
|
4f9a0a | 2002-09-21 | Martin Stjernholm | |
// This triggered a bug only if run sufficiently early.
|
e70eb2 | 2015-11-30 | Martin Nilsson | | test_compile_any([[#pike 7.6]])
|
3daf98 | 2014-02-17 | Martin Nilsson | | test_compile_any([[#pike 7.8]])
|
b8ce9d | 2014-08-24 | Martin Nilsson | | test_compile_any([[#pike 8.0]])
|
63c1a6 | 2014-10-05 | Martin Nilsson | | test_compile_any([[#pike 8.1]])
|
2144ac | 2014-11-24 | Martin Nilsson | | test_compile_any([[#pike 8.2]])
|
ab01ea | 1999-09-21 | Fredrik Hübinette (Hubbe) | |
|
323682 | 2015-11-15 | Martin Nilsson | | ifefun(_verify_internals,
|
c0988f | 1998-04-17 | Fredrik Hübinette (Hubbe) | | [[
test_do(_verify_internals())
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | ]]);
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);
|
3e5021 | 2014-08-18 | Martin Nilsson | | 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);
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | test_true([[1.0e-40]]);
|
a83f8c | 1998-03-20 | Fredrik Hübinette (Hubbe) | | test_eq([[#"foo
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | bar"]],[["foo\nbar"]]);
|
170d58 | 2015-08-23 | Martin Nilsson | | test_eq([[# "foo
bar"]],[["foo\nbar"]]);
|
b62bf6 | 2000-03-30 | Fredrik Hübinette (Hubbe) | | test_eq([[#"foo\
bar"]],[["foobar"]]);
|
e9e53e | 2015-07-07 | Henrik Grubbström (Grubba) | | test_eq([[#(foo
|
606f27 | 2015-07-26 | Henrik Grubbström (Grubba) | | bar#) - "\r"]],[["foo\nbar"]]);
|
170d58 | 2015-08-23 | Martin Nilsson | | test_eq([[# (foo
bar#) - "\r"]],[["foo\nbar"]]);
|
e9e53e | 2015-07-07 | Henrik Grubbström (Grubba) | | test_eq([[#(foo\
|
606f27 | 2015-07-26 | Henrik Grubbström (Grubba) | | bar#) - "\r"]],[["foo\\\nbar"]]);
|
e9e53e | 2015-07-07 | Henrik Grubbström (Grubba) | | test_eq([[#[foo
|
606f27 | 2015-07-26 | Henrik Grubbström (Grubba) | | bar#] - "\r"]],[["foo\nbar"]]);
|
170d58 | 2015-08-23 | Martin Nilsson | | test_eq([[# [foo
bar#] - "\r"]],[["foo\nbar"]]);
|
e9e53e | 2015-07-07 | Henrik Grubbström (Grubba) | | test_eq([[#[foo\
|
606f27 | 2015-07-26 | Henrik Grubbström (Grubba) | | bar#] - "\r"]],[["foo\\\nbar"]]);
|
e9e53e | 2015-07-07 | Henrik Grubbström (Grubba) | | test_eq([[#{foo
|
606f27 | 2015-07-26 | Henrik Grubbström (Grubba) | | bar#} - "\r"]],[["foo\nbar"]]);
|
170d58 | 2015-08-23 | Martin Nilsson | | test_eq([[# {foo
bar#} - "\r"]],[["foo\nbar"]]);
|
e9e53e | 2015-07-07 | Henrik Grubbström (Grubba) | | test_eq([[#{foo\
|
606f27 | 2015-07-26 | Henrik Grubbström (Grubba) | | bar#} - "\r"]],[["foo\\\nbar"]]);
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | test_true([[stringp(#string "Makefile")]]);
|
3488ef | 2000-04-17 | Henrik Grubbström (Grubba) | | test_any([[class Bar { array(int) foo = ({}); };
class Foo { inherit Bar; array(int) foo = ({1}); };
return sizeof(Foo()->foo);]],1);
|
87c9d2 | 1998-04-09 | Fredrik Hübinette (Hubbe) | |
|
649dce | 2008-05-21 | Martin Stjernholm | | test_eq([["(" + 0x7fffffff + ")"]], "(2147483647)")
test_eq([["(" + -0x80000000 + ")"]], "(-2147483648)")
|
3e5021 | 2014-08-18 | Martin Nilsson | | test_eq([["(" + 0x7fffffffffffffff + ")"]], "(9223372036854775807)")
test_eq([["(" + -0x8000000000000000 + ")"]], "(-9223372036854775808)")
|
649dce | 2008-05-21 | Martin Stjernholm | | test_eq([["(" + Int.NATIVE_MAX + ")"]], [[sprintf ("(%d)", Int.NATIVE_MAX)]])
test_eq([["(" + Int.NATIVE_MIN + ")"]], [[sprintf ("(%d)", Int.NATIVE_MIN)]])
|
3362ea | 2012-07-06 | Martin Stjernholm | | test_eq([[Int.NATIVE_MAX]], [[(int) (Int.NATIVE_MAX + "")]])
test_eq([[Int.NATIVE_MIN]], [[(int) (Int.NATIVE_MIN + "")]])
test_eq([[(string) Int.NATIVE_MAX]], [[Int.NATIVE_MAX + ""]])
test_eq([[(string) Int.NATIVE_MIN]], [[Int.NATIVE_MIN + ""]])
test_eq([[(string) Int.NATIVE_MAX]], [[sprintf ("%d", Int.NATIVE_MAX)]])
test_eq([[(string) Int.NATIVE_MIN]], [[sprintf ("%d", Int.NATIVE_MIN)]])
|
649dce | 2008-05-21 | Martin Stjernholm | |
|
137eab | 2014-08-19 | Martin Nilsson | | test_any_equal([[
array res = ({});
array ops = ({ `+, `-, `*, `/, `%, `<<, `>>, `&, `|, `^ });
array nums_a = ({ 0, 1, -1, 0xffffffff, 0xffffffffffffffff });
array nums_b = ({ 0, 1, -1 });
foreach(ops;; function op)
foreach(nums_a;; int a)
foreach(nums_b;; int b)
{
mixed err = catch {
res += ({ op(a,b) });
};
if( err ) res += ({ "E" });
}
return res;
]],[[ ({
// +
0, 1, -1, 1, 2, 0, -1, 0, -2, 0xffffffff, 0x100000000, 0xfffffffe, 0xffffffffffffffff, 0x10000000000000000, 0xfffffffffffffffe,
// -
0, -1, 1, 1, 0, 2, -1, -2, 0, 0xffffffff, 0xfffffffe, 0x100000000, 0xffffffffffffffff, 0xfffffffffffffffe, 0x10000000000000000,
// *
0, 0, 0, 0, 1, -1, 0, -1, 1, 0, 0xffffffff, -0xffffffff, 0, 0xffffffffffffffff, -0xffffffffffffffff,
// /
"E", 0, 0, "E", 1, -1, "E", -1, 1, "E", 0xffffffff, -0xffffffff, "E", 0xffffffffffffffff, -0xffffffffffffffff,
// %
"E", 0, 0, "E", 0, 0, "E", 0, 0, "E", 0, 0, "E", 0, 0,
// <<
0, 0, "E", 1, 2, "E", -1, -2, "E", 0xffffffff, 0x1fffffffe, "E", 0xffffffffffffffff, 0x1fffffffffffffffe, "E",
// >>
0, 0, "E", 1, 0, "E", -1, -1, "E", 0xffffffff, 0x7fffffff, "E", 0xffffffffffffffff, 0x7fffffffffffffff, "E",
// &
0, 0, 0, 0, 1, 1, 0, 1, -1, 0, 1, 0xffffffff, 0, 1, 0xffffffffffffffff,
// |
0, 1, -1, 1, 1, -1, -1, -1, -1, 0xffffffff, 0xffffffff, -1, 0xffffffffffffffff, 0xffffffffffffffff, -1,
// ^
0, 1, -1, 1, 0, -2, -1, -2, 0, 0xffffffff, 0xfffffffe, -0x100000000, 0xffffffffffffffff, 0xfffffffffffffffe, -0x10000000000000000,
}) ]])
|
2166c0 | 2008-05-06 | Henrik Grubbström (Grubba) | | # __func__
test_eq(__func__, "a")
test_eq("b", __func__)
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | test_eq(8, 0b1000);
test_eq(-8, -0b1000);
test_eq(16, 0b10000);
test_eq(-16, -0b10000);
|
565645 | 1999-10-26 | Fredrik Noring | |
|
926208 | 2003-02-26 | Martin Stjernholm | | test_true(1e-100000000000000000000000000000000000000000000000000000000000<=1e-10000)
|
6f3577 | 2003-02-26 | Mirar (Pontus Hagland) | | 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)
|
926208 | 2003-02-26 | Martin Stjernholm | | test_true(1e10000<=1e100000000000000000000000000000000000000000000000000000000000)
|
6f3577 | 2003-02-26 | Mirar (Pontus Hagland) | |
|
0346dc | 2014-05-10 | Martin Nilsson | | test_compile_error('\3434523423423523423423423423')
test_compile_error("\3434523423423523423423423423")
test_compile_error("\d109827346981234561823743412654")
|
9a90b3 | 2014-10-22 | Per Hedbor | | test_compile_error('\d109827346981234561823743412654')
|
0346dc | 2014-05-10 | Martin Nilsson | | test_compile_error("\x109a27bc69e256c83deaa34c26b4")
|
9a90b3 | 2014-10-22 | Per Hedbor | | test_compile_error('\x109a27bc69e256c83deaa34c26b4')
|
b168bb | 2004-11-01 | Martin Stjernholm | | test_compile_error('\u17fo')
|
0346dc | 2014-05-10 | Martin Nilsson | | test_compile_error("\u17fo")
|
9a90b3 | 2014-10-22 | Per Hedbor | |
test_eq('012456789abcdefghijklmnopqrstuvwxyz'->digits(256),
"012456789abcdefghijklmnopqrstuvwxyz")
test_eq('\uu117f', 0x5c7531313766)
|
aee0b5 | 2004-11-16 | Martin Stjernholm | | test_eq("\uuuu17fo", "\\uuu17fo")
|
b168bb | 2004-11-01 | Martin Stjernholm | | test_eq('\u117f', 0x117f)
test_eq("\u117foo", "\10577oo")
test_eq("\u1117foo", "\10427foo")
test_eq("\uuuu117foo", "\\uuu117foo")
test_compile_error('\U117f')
|
0346dc | 2014-05-10 | Martin Nilsson | | test_compile_error("\U117f")
test_compile_error("\UdEaDbEaT")
|
aee0b5 | 2004-11-16 | Martin Stjernholm | | test_eq("\UUdEaDbEaT", "\\UdEaDbEaT")
|
b168bb | 2004-11-01 | Martin Stjernholm | | test_eq('\UDeaDBeEF', -559038737)
test_eq("\UDeaDBeEFFF", "\33653337357FF")
test_eq("\UUDeaDBeEFFF", "\\UDeaDBeEFFF")
|
e80a29 | 2002-02-28 | Martin Stjernholm | | test_do([[
|
bcc7d6 | 2002-04-12 | Martin Nilsson | | // bug 2677
|
e80a29 | 2002-02-28 | Martin Stjernholm | | int x;
if (time())
x = 1;
else
foo: break foo;
]])
|
14dd02 | 2002-06-11 | Henrik Grubbström (Grubba) | | 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)
|
805ea6 | 2002-02-26 | Martin Stjernholm | | test_any([[
int f (int i) {i = 0; return i;};
return f (1);
]],0)
|
fa7892 | 2001-07-28 | Fredrik Hübinette (Hubbe) | | test_any([[
|
c20941 | 2002-11-13 | Henrik Grubbström (Grubba) | | // Test that F_TAIL_RECUR and RECUR work properly.
class X
{
int Ack(int M, int N) {
if (M == 0) return( N + 1 );
if (N == 0) return( Ack(M - 1, 1) );
return( Ack(M - 1, Ack(M, (N - 1))) );
}
};
return X()->Ack(3,5);
]],253)
test_any([[
// Test that F_COND_RECUR works properly.
|
daf649 | 2002-11-14 | Henrik Grubbström (Grubba) | | // This test forces F_COND_RECUR to fail.
|
c20941 | 2002-11-13 | Henrik Grubbström (Grubba) | | class X
{
int Ack(int M, int N) {
if (M == 0) return( N + 1 );
if (N == 0) return( Ack(M - 1, 1) );
return( Ack(M - 1, Ack(M, (N - 1))) );
}
};
|
fa7892 | 2001-07-28 | Fredrik Hübinette (Hubbe) | |
|
daf649 | 2002-11-14 | Henrik Grubbström (Grubba) | | class Y { inherit X;
int Ack(int M, int N) { return ::Ack(M, N); }
};
|
fa7892 | 2001-07-28 | Fredrik Hübinette (Hubbe) | |
|
c20941 | 2002-11-13 | Henrik Grubbström (Grubba) | | return Y()->Ack(2,2);
|
fa7892 | 2001-07-28 | Fredrik Hübinette (Hubbe) | | ]],7)
|
20043f | 2008-07-17 | Henrik Grubbström (Grubba) | | test_any([[
// Test that F_RECUR et al are not used for inlined functions
// where the scope is in use.
class X {
inline function(int:int) foo(int x, int y)
{
if (y) return foo(x+y, y-1);
return lambda(int z) { return x+z; };
}
};
return X()->foo(10, 3)(5);
]], 21)
|
ce9bfb | 2002-12-20 | Henrik Grubbström (Grubba) | | test_any([[
// Test that loop optimizer isn't too aggressive.
// Thanks to Alexander Demenshin <aldem-pike@aldem.net>
int x,y,a;
for(;x<10000;x++) {
y += (x - a++);
}
return a;
]], 10000)
test_any([[
// Test that loop optimizer isn't too aggressive.
// Thanks to Alexander Demenshin <aldem-pike@aldem.net>
mapping m = ([]);
for(;m->x<10000;m->x++) {
m->y += (m->x - m->a++);
}
return m->a;
]], 10000)
|
4ce36d | 2003-01-29 | Marcus Comstedt | | test_any([[
// Test that loop optimizer isn't too aggressive.
// Thanks to me. / Marcus
for(int i=0; i<3.0; i++)
if(i>4.0)
return -1;
return 0;
]], 0)
|
f88fda | 2003-03-21 | Johan Sundström | | test_any([[
// Test that optimizer notes side effects in arguments to `!=
// Thanks to Marcus Agehall
int j = 20, i;
string end = "17";
for( ; i < j ; i++)
if(sscanf(end, "%d%s", j, end) != 2)
cd(".");
return i;
]], 17)
|
07b70d | 2014-10-27 | Martin Nilsson | | test_any([[
for(int i; i<10; i++) ;
return 1;
]], 1)
|
9002ef | 2004-04-29 | Martin Nilsson | | test_any([[
// Another over-optimization test.
string x(string i) { return i; };
return x("")+1+1;
]], "11")
|
df23b9 | 2009-11-20 | Henrik Grubbström (Grubba) | | test_any([[
|
5dffec | 2015-12-27 | Martin Nilsson | | /* don't save parent */
|
df23b9 | 2009-11-20 | Henrik Grubbström (Grubba) | | // Check that parent pointers aren't added unnecessarily [bug 2672].
class I {};
class X
{
// Neither the inherit nor the variable type should add
// a parent pointer requirement.
inherit I;
I i;
};
X x = ((program) X)(); // Error: Parent lost, cannot clone program.
return 0;
]], 0)
|
204536 | 2011-03-28 | Henrik Grubbström (Grubba) | | test_any([[
|
5dffec | 2015-12-27 | Martin Nilsson | | /* don't save parent */
|
df23b9 | 2009-11-20 | Henrik Grubbström (Grubba) | | // Check that parent pointers aren't added unnecessarily [bug 2672].
class I {};
class X
{
|
204536 | 2011-03-28 | Henrik Grubbström (Grubba) | | // The cloning of I makes X need its parent usually,
// but note that since we're nested in a function
// scope by the testsuite, I will not be overloadable,
// and thus we won't need the parent.
|
df23b9 | 2009-11-20 | Henrik Grubbström (Grubba) | | inherit I;
I i = I();
};
X x = ((program) X)(); // Error: Parent lost, cannot clone program.
return 0;
]], 0)
|
204536 | 2011-03-28 | Henrik Grubbström (Grubba) | | test_eval_error([[
class Wrapper {
// Check that parent pointers aren't added unnecessarily [bug 2672].
class I {}
class X
{
// The cloning of I makes X need its parent.
inherit I;
I i = I();
}
};
object x = ((program) (Wrapper()->X))(); // Error: Parent lost, cannot clone program.
return 0;
]], 0)
test_any([[
// Check that parent pointers aren't added unnecessarily [LysLysKOM 18781511].
class Foo {
|
e68090 | 2015-03-22 | Henrik Grubbström (Grubba) | | final constant const_val = 1;
|
204536 | 2011-03-28 | Henrik Grubbström (Grubba) | | class Bar
{
int func()
{
|
e68090 | 2015-03-22 | Henrik Grubbström (Grubba) | | // parent-pointer not needed, since const_val is final.
return const_val;
|
204536 | 2011-03-28 | Henrik Grubbström (Grubba) | | };
}
};
return !Foo.Bar;
]], 0)
|
f53802 | 2003-02-25 | Marcus Comstedt | | test_compile_any([[
|
13670c | 2015-05-25 | Martin Nilsson | | mixed foo()
|
f53802 | 2003-02-25 | Marcus Comstedt | | {
Stdio.File bar(int x, int y)
|
13670c | 2015-05-25 | Martin Nilsson | | {
|
f53802 | 2003-02-25 | Marcus Comstedt | | return 0;
|
161582 | 2008-01-04 | Henrik Grubbström (Grubba) | | };
return bar;
|
13670c | 2015-05-25 | Martin Nilsson | | }
|
f53802 | 2003-02-25 | Marcus Comstedt | | ]])
|
7a8442 | 2003-10-10 | Martin Stjernholm | | test_compile_any([[
string foo (string a, string b, string c, string d, string e, string f, string g)
{
string out;
if (a)
out = "foo";
else
out = "bar";
return out;
}
]])
|
c69116 | 2016-04-25 | Henrik Grubbström (Grubba) | | test_compile_any([[
mixed foo()
{
array a;
array b = a->f("b")?->b;
return b;
}
]])
|
127316 | 2014-07-02 | Arne Goedeke | | define(test_string_range,[[
test_any([[
string s = (string) ({ $1, $1 });
if (!arrayp(String.range(s))) return "huh?"; // dont optimize this, it forces string range check
return search(s, $1);
]], 0)
]])
test_string_range(254);
test_string_range(255);
test_string_range((1<<16)-1);
test_string_range((1<<16)+1);
test_string_range((1<<29)-1);
test_string_range((1<<29)+1);
test_string_range((1<<31)-1);
test_string_range(-(1<<31));
|
2fa122 | 2006-03-01 | Henrik Grubbström (Grubba) | | dnl number of variables/scope, number of scopes, expect_compiler_error
define(test_scopes,[[
|
887c59 | 2006-03-01 | Henrik Grubbström (Grubba) | | test_any([[
|
50ab1c | 2010-07-12 | Martin Stjernholm | | log_status("Testing scoped variables $1:$2%s...",
$3?" expecting a compilation error":"");
|
887c59 | 2006-03-01 | Henrik Grubbström (Grubba) | | string line = sprintf("#line %d %O\n", __LINE__, __FILE__);
|
2fa122 | 2006-03-01 | Henrik Grubbström (Grubba) | | string s = "{\n" +
(map(indices(allocate($1)), lambda(int no) {
no++;
return sprintf(" int var_%d;\n"
" if (var_%d)\n"
" error(\"Variable var_%d not \"\n"
" \"initialized to zero: \"\n"
" \"%%O\\n\",\n"
" var_%d);\n"
" var_%d = %d;\n",
no, no, no, no, no, no);
}) +
map(indices(allocate($1)), lambda(int no) {
no++;
return sprintf(" if (var_%d != %d)\n"
" error(\"Variable var_%d was \"\n"
" \"clobbered with %%O.\\n\",\n"
" var_%d);\n",
no, no, no, no);
})) * "" +
"}\n";
program p;
|
d55352 | 2007-06-18 | Martin Stjernholm | | if ($3) master()->set_inhibit_compile_errors (1);
|
2fa122 | 2006-03-01 | Henrik Grubbström (Grubba) | | mixed err = catch {
p = compile_string("int a() {\n" + line + (s * $2) +
" return 0;\n"
"}\n");
};
if ($3) {
|
d55352 | 2007-06-18 | Martin Stjernholm | | master()->set_inhibit_compile_errors (0);
|
2fa122 | 2006-03-01 | Henrik Grubbström (Grubba) | | if (err) return 0;
error("Expected a compilation error for $1 variables in $2 scope%s.\n",
($2>1)?"s":"");
}
if (err) throw(err);
|
887c59 | 2006-03-01 | Henrik Grubbström (Grubba) | | return p()->a();
]], 0)
]])
|
2fa122 | 2006-03-01 | Henrik Grubbström (Grubba) | | test_scopes(255, 1, 0)
test_scopes(256, 1, 1)
test_scopes(16, 17, 0)
test_scopes(17, 16, 0)
|
4ce36d | 2003-01-29 | Marcus Comstedt | |
|
078c60 | 2006-03-02 | Henrik Grubbström (Grubba) | | test_any([[
// LysLysKOM 14180500
if (1) {
string var = "Reinitialization error.";
}
sscanf("", "%d", int zero);
return zero;
]], 0);
|
414ab9 | 2006-03-04 | Henrik Grubbström (Grubba) | | test_any([[
// LysLysKOM 14189033
int i;
for (i = 0; i < 4; i++) {
sscanf("", "%d", int test);
if (test) return test;
test = i+1;
}
return 0;
]], 0)
|
ae0ac1 | 2002-11-14 | Henrik Grubbström (Grubba) | | dnl FIXME: Add test that local and local:: in combination
dnl with recursion works correctly.
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | test_eval_error([[mixed x; return mkmapping(x,x)]]);
|
97431e | 1999-03-19 | Fredrik Hübinette (Hubbe) | |
|
3488ef | 2000-04-17 | Henrik Grubbström (Grubba) | | test_eval_error([[class Foo {
void bar() {}
|
f960bd | 2015-07-31 | Martin Nilsson | | void foo() {destruct(this);bar();}
|
3488ef | 2000-04-17 | Henrik Grubbström (Grubba) | | };
Foo()->foo();
]])
|
7ddaa3 | 2000-08-22 | Martin Stjernholm | | test_do([[
void foo (int i) {
multiset res = (<>);
if (i) res = res;
};
foo (1);
]])
|
5e4442 | 2001-02-25 | Fredrik Hübinette (Hubbe) | | test_any([[
array tmp=({});
tmp=({([])})+tmp;
tmp->foo=7;
tmp=({([])})+tmp;
return sizeof(tmp[0]);
]], 0)
|
52032c | 2008-05-12 | Henrik Grubbström (Grubba) | | test_any([[
// Bug 4537.
void fiddle(array(int) a)
{
a += ({ 2 });
};
array(int) a = ({ 1 });
fiddle(a);
return sizeof(a);
]], 1)
|
5e4442 | 2001-02-25 | Fredrik Hübinette (Hubbe) | |
|
774f9a | 2011-03-21 | Martin Stjernholm | | test_eval_error([[
// [Bug 5911]
class X {
string s;
};
X()->s = (mixed) X();
]])
|
b0dfbb | 2011-09-04 | Martin Nilsson | | test_any([[
// Bug 6062
class C { mapping options = ([ 1:1 ]); };
C c = C();
c->options[3] = 3;
c = C();
return sizeof(c->options) == 1;
]], 1)
|
6c98ca | 2011-09-05 | Henrik Grubbström (Grubba) | | test_any([[
// Bug 6063
class A { extern string s; string q() { return s; } };
class B { inherit A; string s = "s"; };
class C { inherit B; };
class D { inherit C; };
return ({ B(), C(), D() })->q() * "";
]], "sss")
|
6bf0fa | 2011-09-12 | Henrik Grubbström (Grubba) | | test_any([[
// bug 6065
class A(string s) {};
class B(string s) { inherit A; };
return B("foo")->s;
]], "foo")
|
49a00f | 2018-02-02 | Henrik Grubbström (Grubba) | | test_any_equal([[
class A{ constant sym = 1; }
class B{ constant sym = 2; inherit A; }
return indices(B);
]], ({ "sym" }))
test_any_equal([[
class A{ constant sym = 1; }
class B{ inherit A; constant sym = 2; }
return indices(B);
]], ({ "sym" }))
test_any_equal([[
class A{ constant sym = 1; }
class B{ constant sym = 2; inherit A; }
return values(B);
]], ({ 2 }))
test_any_equal([[
class A{ constant sym = 1; }
class B{ inherit A; constant sym = 2; }
return values(B);
]], ({ 2 }))
test_any_equal([[
class A{ constant sym = 1; }
class B{ constant sym = 2; inherit A; }
return indices(B());
]], ({ "sym" }))
test_any_equal([[
class A{ constant sym = 1; }
class B{ inherit A; constant sym = 2; }
return indices(B());
]], ({ "sym" }))
test_any_equal([[
class A{ constant sym = 1; }
class B{ constant sym = 2; inherit A; }
return values(B());
]], ({ 2 }))
test_any_equal([[
class A{ constant sym = 1; }
class B{ inherit A; constant sym = 2; }
return values(B());
]], ({ 2 }))
|
fdd6a8 | 2008-10-13 | Mirar (Pontus Hagland) | | dnl bug in for loop optimization in combination with +=
test_any([[
|
13670c | 2015-05-25 | Martin Nilsson | | array v=({1,2,3});
for (int i=0; i<sizeof(v); i++)
for (int j=0; j<i; j++)
{
v+=({1+i});
if (i==17) { i=10000; break; }
}
|
fdd6a8 | 2008-10-13 | Mirar (Pontus Hagland) | | return sizeof(v); // if buggy, will be 6 and not 140
]], 140);
test_any([[
|
13670c | 2015-05-25 | Martin Nilsson | | array v=({1,2,3});
for (int i=0; i<sizeof(v); i++)
for (int j=0; j<i; j++)
{
v=v+({1+i});
if (i==17) { i=10000; break; }
}
|
fdd6a8 | 2008-10-13 | Mirar (Pontus Hagland) | | return sizeof(v); // not buggy, will be 140
]], 140);
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | test_any([[int a=0xffffffff; return a+17]], 0x100000010);
test_any([[int a=0xffffffff; return a-17]], 0xffffffee);
test_any([[int a=0xffffffff; return a*17]], 0x10ffffffef);
test_any([[int a=0xffffffff; return a^17]], 0xffffffee);
test_any([[int a=0xffffffff; return a&17]], 17);
test_any([[int a=0xffffffff; return a|17]], 0xffffffff);
test_any([[int a=0xffffffff; return a<<17]], 0x1fffffffe0000);
|
2b2df2 | 1999-11-01 | Henrik Grubbström (Grubba) | |
test_any([[ int a=0xffffffff; return a/17 ]],
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | [[ (0xffffffff == -1)?-1:0x0f0f0f0f ]]);
|
2b2df2 | 1999-11-01 | Henrik Grubbström (Grubba) | | test_any([[ int a=0xffffffff; return a%17 ]],
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | [[ (0xffffffff == -1)?16:0 ]]);
|
2b2df2 | 1999-11-01 | Henrik Grubbström (Grubba) | | test_any([[ int a=0xffffffff; return a>>17 ]],
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | [[ (0xffffffff == -1)?-1:0x7fff ]]);
|
f61d77 | 2013-12-12 | Henrik Grubbström (Grubba) | | dnl Check the derived return type of sprintf().
test_any([[return sprintf("%O", typeof(sprintf("%1H", "foo"))); ]],
|
a2f242 | 2014-01-05 | Henrik Grubbström (Grubba) | | "string(8bit)");
|
f61d77 | 2013-12-12 | Henrik Grubbström (Grubba) | | test_any([[return sprintf("%O", typeof(sprintf("foo"))); ]],
"string(102..111)");
test_any([[return sprintf("%O", typeof(sprintf("foo%c", 17))); ]],
"string(17..17 | 102..111)");
test_any([[return sprintf("%O", typeof(sprintf("%2c\n", 'a'))); ]],
|
a2f242 | 2014-01-05 | Henrik Grubbström (Grubba) | | "string(8bit)");
|
8b2dd4 | 2014-08-31 | Henrik Grubbström (Grubba) | | dnl Note the following tests the return type of int2char().
|
f61d77 | 2013-12-12 | Henrik Grubbström (Grubba) | | test_any([[return sprintf("%O", typeof(sprintf("%c", 1023))); ]],
"string(1023..1023)");
test_any([[return sprintf("%O", typeof(sprintf("%c\n", 1023))); ]],
"string(10..10 | 1023..1023)");
|
8b2dd4 | 2014-08-31 | Henrik Grubbström (Grubba) | | dnl The following is due to (string & sprintf_result) == sprintf_result.
|
f61d77 | 2013-12-12 | Henrik Grubbström (Grubba) | | test_any([[return sprintf("%O", typeof(sprintf("%c\n", Stdio))); ]],
|
8b2dd4 | 2014-08-31 | Henrik Grubbström (Grubba) | | sprintf("%O", sprintf_result));
|
f61d77 | 2013-12-12 | Henrik Grubbström (Grubba) | | test_any([[return sprintf("%O", typeof(sprintf("%4[1]c", 17))); ]],
|
a2f242 | 2014-01-05 | Henrik Grubbström (Grubba) | | "string(8bit)");
|
f61d77 | 2013-12-12 | Henrik Grubbström (Grubba) | | test_any([[return sprintf("%O", typeof(sprintf("%[1]n", 17))); ]],
"string(zero)");
|
b34726 | 2013-06-03 | Martin Nilsson | | test_any([[return sprintf("%O", typeof(aggregate("foo")));]], "array(string(102..111))");
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | test_any([[int a; return sprintf("%O", typeof(aggregate(a)));]], "array(int)");
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | | test_any([[int|string a;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | string s = sprintf("%O", typeof(aggregate(a)));
|
3b30c9 | 2007-04-03 | Henrik Grubbström (Grubba) | | return (< "array(string) | array(int)", "array(string | int)", "array(int | string)" >)[s];]], 1);
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | test_any([[return sprintf("%O", typeof(aggregate()));]], "array(zero)");
|
1954be | 1999-12-10 | Henrik Grubbström (Grubba) | | test_any([[int i; return (< "int", "int | zero", "zero | int" >)
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | [sprintf("%O", typeof(max(i,0)))];]], 1)
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | |
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | test_any([[array(string) a; return sprintf("%O", typeof(a[0])); ]], "string")
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | |
test_any([[class foo { string a; };
object(foo) bar;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(bar->a));]], "string");
|
3b7464 | 1999-11-24 | Henrik Grubbström (Grubba) | |
test_any([[class foo { string a; };
array(object(foo)) bar;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(bar[0]->a));]], "string");
|
94b524 | 1999-11-01 | Mirar (Pontus Hagland) | |
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | test_any([[function(:string)|function(int:int) f;
return sprintf("%O", typeof(f())); ]],
|
f2e6a4 | 1999-11-24 | Henrik Grubbström (Grubba) | | "string")
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | test_any([[function(:string)|function(int:int) f;
return sprintf("%O", typeof(f(1))); ]],
|
f2e6a4 | 1999-11-24 | Henrik Grubbström (Grubba) | | "int")
|
dc19e7 | 1999-11-24 | Henrik Grubbström (Grubba) | | test_any([[function(:string)|function(mixed, mixed...:int) f;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(f())); ]],
|
dc19e7 | 1999-11-24 | Henrik Grubbström (Grubba) | | "string")
test_any([[function(:string)|function(mixed, mixed ...:int) f;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(f(1))); ]],
|
dc19e7 | 1999-11-24 | Henrik Grubbström (Grubba) | | "int")
|
00091b | 1999-12-05 | Martin Stjernholm | | test_any([[mapping(object:string)|mapping(string:int) f;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(f[class{}()])); ]],
|
00091b | 1999-12-05 | Martin Stjernholm | | "string")
test_any([[mapping(object:string)|mapping(string:int) f;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(f[""])); ]],
|
00091b | 1999-12-05 | Martin Stjernholm | | "int")
test_any([[mapping(object:string)|mapping(string:int) f;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sort((sprintf("%O", typeof(f[0])) - " ")/"|")*"|"; ]],
|
00091b | 1999-12-05 | Martin Stjernholm | | "int|string")
|
4d7b18 | 1999-12-07 | Fredrik Hübinette (Hubbe) | | test_any([[class Foo { string `[](mixed y) {return "";} };
|
b6733a | 1999-12-05 | Henrik Grubbström (Grubba) | | object(Foo) foo;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(foo[0])); ]],
|
b6733a | 1999-12-05 | Henrik Grubbström (Grubba) | | "string")
|
f60091 | 1999-12-05 | Henrik Grubbström (Grubba) | | test_any([[class Foo { array(int) _indices() {return ({0});} };
|
b6733a | 1999-12-05 | Henrik Grubbström (Grubba) | | object(Foo) foo;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(indices(foo))); ]],
|
f60091 | 1999-12-05 | Henrik Grubbström (Grubba) | | "array(int)")
|
b6733a | 1999-12-05 | Henrik Grubbström (Grubba) | |
test_any([[class Foo { array(string) _values() {return ({""});} };
object(Foo) foo;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(values(foo))); ]],
|
b6733a | 1999-12-05 | Henrik Grubbström (Grubba) | | "array(string)")
|
ffb7fe | 1999-12-08 | Henrik Grubbström (Grubba) | | test_any([[mapping(string:int) foo;
array(string) bar;
|
440592 | 2000-05-25 | Henrik Grubbström (Grubba) | | return sprintf("%O", typeof(rows(foo, bar))); ]],
|
ffb7fe | 1999-12-08 | Henrik Grubbström (Grubba) | | "array(int)")
|
c49442 | 2016-01-04 | Per Hedbor | | // basic auto tests.
test_any([[
class Toplevel {
class Foo {
auto a = 10;
auto b = typeof(a);
};
string test() {
|
300d02 | 2016-11-05 | Martin Nilsson | | return sprintf("a%Ob%O", typeof(Foo()->a),typeof(Foo()->b));
|
c49442 | 2016-01-04 | Per Hedbor | | };
};
return Toplevel()->test();
]], "aint(10..10)btype(int(10..10))");
test_any([[{
class Toplevel {
class Foo {
auto test(){ return 10;return 20;return 30; };
};
string test() {
|
300d02 | 2016-11-05 | Martin Nilsson | | return sprintf("%O", typeof(Foo()->test));
|
c49442 | 2016-01-04 | Per Hedbor | | }
};
return Toplevel()->test()-" ";
}]], "function(:int(10..10)|int(20..20)|int(30..30))");
|
85ff73 | 2001-07-03 | Martin Stjernholm | | test_any([[{
class Foo
{
mixed m;
|
537f1e | 2001-07-03 | Henrik Grubbström (Grubba) | | };
|
85ff73 | 2001-07-03 | Martin Stjernholm | | class Bar
{
inherit Foo;
string m;
Foo b;
|
537f1e | 2001-07-03 | Henrik Grubbström (Grubba) | | mixed f() {
return typeof(b->m);
}
};
|
f704a2 | 2001-07-03 | Henrik Grubbström (Grubba) | | Foo c;
Bar d;
|
537f1e | 2001-07-03 | Henrik Grubbström (Grubba) | | return sprintf("%O$%O$%O$%O",
Bar()->f(), typeof(c->m), typeof(d->m), typeof(d->b->m));
|
f704a2 | 2001-07-03 | Henrik Grubbström (Grubba) | | }]], "mixed$mixed$string$mixed")
|
85ff73 | 2001-07-03 | Martin Stjernholm | |
|
32efc9 | 2003-03-07 | Henrik Grubbström (Grubba) | | // las.c:find_return_type() checks.
test_eq([[
// Test case from Robert J. Budzynski <Robert.Budzynski@fuw.edu.pl>.
// When broken the return type will be mixed.
sprintf("%O", typeof(lambda(string s){
|
0b8d2f | 2013-06-17 | Martin Nilsson | | return Charset.decoder("utf-8")->feed(s)->drain();
|
32efc9 | 2003-03-07 | Henrik Grubbström (Grubba) | | }))
]], [[ "function(string : string)" ]])
|
9d3a7a | 2005-02-18 | Henrik Grubbström (Grubba) | | // Test implicit lambda.
test_eq([[
`()(){ return 1; }
]], 1)
|
cc8b3b | 2017-11-02 | Henrik Grubbström (Grubba) | | test_equal([[
lambda(array a, function f) { return f(@a); }
(({ 0, 1, 2, 3 })){ return __ARGS__; }
]], ({ 0, 1, 2, 3}))
|
d96720 | 2004-02-28 | Martin Stjernholm | | // Argument checking
|
bed458 | 2012-07-12 | Henrik Grubbström (Grubba) | | // Test new_check_call.
|
c287ef | 2012-07-18 | Henrik Grubbström (Grubba) | | test_any([[
|
bed458 | 2012-07-12 | Henrik Grubbström (Grubba) | | constant foo = 5;
// Test that it survives a F_ARG_LIST with CAR == CDR.
return foo%foo;
]], 0)
|
d96720 | 2004-02-28 | Martin Stjernholm | | // Test get_all_args.
test_eval_error([[
// A trick to get some svalues to freed refcounted stuff on the stack.
lambda (mixed a, mixed b, mixed c) {} (({time()}), ({time()}), ({time()}));
// set_weak_flag is chosen since it calls get_all_args with an
// argument spec that contains two arguments of different types.
([function] set_weak_flag)();
]])
test_eval_error([[
lambda (mixed a, mixed b, mixed c) {} (({time()}), ({time()}), ({time()}));
([function] set_weak_flag) (17);
]])
test_eval_error([[
lambda (mixed a, mixed b, mixed c) {} (({time()}), ({time()}), ({time()}));
([function] set_weak_flag) ("foo");
]])
test_eval_error([[
lambda (mixed a, mixed b, mixed c) {} (({time()}), ({time()}), ({time()}));
([function] set_weak_flag) (17, "foo");
]])
|
ac1e89 | 2009-03-11 | Marcus Comstedt | | // Check that write() and error() with one argument are not
// incorrectly subjected to sprintf() argument
test_compile([[write("%\u2323");]])
test_compile([[error("%\u2323");]])
|
5bcd22 | 2001-02-21 | Mirar (Pontus Hagland) | | // type checks
define(test_type_error, [[
test_compile_error([[ $1 x; x=$3; ]])
|
6b3f5c | 2002-04-11 | Martin Nilsson | | test_compile_error_any([[ class ErrBa { $1 x() { return $3; } } ]])
test_compile_error_any([[ class ErrBa { $1 x() { $2 a=$3; return a; } } ]])
|
5bcd22 | 2001-02-21 | Mirar (Pontus Hagland) | | ]])
test_type_error(int,float,17.23)
test_type_error(int,array,({1,2,3}))
test_type_error(int,mapping,([1:2,3:4]))
test_type_error(int,multiset,(<1,2,3>))
test_type_error(int,function,lambda() { return 17; })
|
f960bd | 2015-07-31 | Martin Nilsson | | test_type_error(int,program,this_program)
test_type_error(int,object,this)
|
5bcd22 | 2001-02-21 | Mirar (Pontus Hagland) | |
test_type_error(float,int,17)
test_type_error(float,array,({1,2,3}))
test_type_error(float,mapping,([1:2,3:4]))
test_type_error(float,multiset,(<1,2,3>))
test_type_error(float,function,lambda() { return 17; })
|
f960bd | 2015-07-31 | Martin Nilsson | | test_type_error(float,program,this_program)
test_type_error(float,object,this)
|
5bcd22 | 2001-02-21 | Mirar (Pontus Hagland) | |
test_type_error(array,int,17)
test_type_error(array,float,17.23)
test_type_error(array,mapping,([1:2,3:4]))
test_type_error(array,multiset,(<1,2,3>))
test_type_error(array,function,lambda() { return 17; })
|
f960bd | 2015-07-31 | Martin Nilsson | | test_type_error(array,program,this_program)
test_type_error(array,object,this)
|
5bcd22 | 2001-02-21 | Mirar (Pontus Hagland) | |
test_type_error(mapping,int,17)
test_type_error(mapping,float,17.23)
test_type_error(mapping,array,({1,2,3}))
test_type_error(mapping,multiset,(<1,2,3>))
test_type_error(mapping,function,lambda() { return 17; })
|
f960bd | 2015-07-31 | Martin Nilsson | | test_type_error(mapping,program,this_program)
test_type_error(mapping,object,this)
|
5bcd22 | 2001-02-21 | Mirar (Pontus Hagland) | |
test_type_error(multiset,int,17)
test_type_error(multiset,float,17.23)
test_type_error(multiset,array,({1,2,3}))
test_type_error(multiset,mapping,([1:2,3:4]))
test_type_error(multiset,function,lambda() { return 17; })
|
f960bd | 2015-07-31 | Martin Nilsson | | test_type_error(multiset,program,this_program)
test_type_error(multiset,object,this)
|
5bcd22 | 2001-02-21 | Mirar (Pontus Hagland) | |
test_type_error(function,int,17)
test_type_error(function,float,17.23)
test_type_error(function,array,({1,2,3}))
test_type_error(function,mapping,([1:2,3:4]))
test_type_error(function,multiset,(<1,2,3>))
test_type_error(program,int,17)
test_type_error(program,float,17.23)
test_type_error(program,array,({1,2,3}))
test_type_error(program,mapping,([1:2,3:4]))
test_type_error(program,multiset,(<1,2,3>))
test_type_error(object,int,17)
test_type_error(object,float,17.23)
test_type_error(object,array,({1,2,3}))
test_type_error(object,mapping,([1:2,3:4]))
test_type_error(object,multiset,(<1,2,3>))
|
b5ca84 | 2009-06-22 | Henrik Grubbström (Grubba) | | test_any_equal([[
// This code caused a NULL dereference in Pike 7.8.306 and earlier.
indices foo;
return typeof(foo);
]], typeof(indices((mixed)0)))
|
b8efef | 2008-09-12 | Henrik Grubbström (Grubba) | | // Check that complex function types survive soft casting to function.
|
a4cf89 | 2008-09-12 | Henrik Grubbström (Grubba) | | ignore_warning("Soft cast of scope(0 |