pike.git / src / testsuite.in

version» Context lines:

pike.git/src/testsuite.in:1: - test_true([["$Id: testsuite.in,v 1.548 2002/10/12 13:14:44 nilsson Exp $"]]); + test_true([["$Id: testsuite.in,v 1.549 2002/10/13 23:11:34 nilsson Exp $"]]);      // This triggered a bug only if run sufficiently early.   test_compile_any([[#pike 7.2]])      cond([[all_constants()->_verify_internals]],   [[    test_do(_verify_internals())   ]]);   test_eq(1e1,10.0);   test_eq(1E1,10.0);
pike.git/src/testsuite.in:527:   add_constant("test_a",compile_string("int foo();","test_a"));   add_constant("test_b",compile_string("int foo();","test_b"));   add_constant("test_c",compile_string(    "inherit test_a;\n"    "inherit test_b;\n"    "final int foo() { return 1; }\n","test_c"));    res=compile_string("inherit test_c;\n","test_d")()->foo();   };   return res;    ]],1); + test_do(add_constant("test_a")) + test_do(add_constant("test_b")) + test_do(add_constant("test_c"))      test_any( [[   // bug [1858] ------------------------------------------------------------   // http://community/crunch/show_bug.cgi?id=1858   string s=#"    constant foo=({this_object()});    int|string test()    {    if (!foo[0]) return sprintf(\"foo is %O\\n\",foo)-\"\\n\";    if (foo[0]==this_object()) return 1;
pike.git/src/testsuite.in:880:    }    else {    iter = 2;    foreach (({0, monitor::lock()}), mixed m) {    a (1); // F_RECUR_AND_POP    return iter;    }    }    }   ]]); + test_do(add_constant("f")) + test_do(add_constant("monitor"))      test_false([[object_variablep(class X { int y; int z() { return 1; }}(),"foo")]])   test_false([[object_variablep(class X { int y; int z() { return 1; }}(),"z")]])   test_true([[object_variablep(class X { int y; int z() { return 1; }}(),"y")]])      test_any([[ int a,b; [a,b]=({1,2}); return a]],1)   test_any([[ int a,b; [a,b]=({1,2}); return b]],2)   test_any([[ int a,b; [ [a],b]=({ ({ 1 }) ,2}); return a]],1)   test_any([[ int a,b; [ [a],b]=({ ({ 1 }) ,2}); return b]],2)   test_any([[ int a; catch { [a]=({1,2}); }; return 1]],1)
pike.git/src/testsuite.in:1589:    replace_master (orig_master);    if (err) throw (err);       Stdio.recursive_rm ("testsuite_test_dir.pmod");   ]]);   ]]);      test_compile_any([[int log() { return 17; } class Greta { int hanna() { return log(); } }]])   test_compile_any([[int kajsa(int a,int b) { return 17; } class Jenny { int kajsa() { return 17; } class Greta { int hanna() { return kajsa(); } } }]])   test_any([[add_constant("kajsa",lambda(int a,int b) { return 17; }); return compile_string("int kajsa() { return 17; } class Greta { int hanna() { return kajsa(); } }")()->kajsa()]],17) + test_do(add_constant("kajsa"))      test_compile([[Stdio.File foo=Stdio.File();]])   test_compile([[ string|multiset(string) foo;    array(string) gazonk;    array(string) bar = indices(foo)-gazonk;   ]])   test_compile([[class { Stdio.File foo=Stdio.File(); }]])   test_compile_any([[void foo(Stdio.FILE f) {}]])   test_compile_any([[void foo(array(Stdio.FILE) f) {}]])   test_compile_any([[void foo(array(Stdio.FILE) f) {}]])
pike.git/src/testsuite.in:7863:      // - destruct   // FIXME put tests for destruct here.   test_do(add_constant("PROG",compile_string("int foo() { return 1; }")));   test_any([[object o=clone(PROG); destruct(o); return o]],0);   test_any([[object o=clone(PROG); destruct(o); return objectp(o)]],0);   test_any([[array(object) o=({clone(PROG)}); destruct(o[0]); return o-({0}) ]],({}));   test_any([[mapping o=(["foo":clone(PROG)]); destruct(o["foo"]); return o["foo"]; ]],0);   dnl test_any([[object t; mapping o=([t=clone(PROG):"foo"]); destruct(t); return sizeof(o)]],0);   test_do([[object t; array(object) o=({}); o+=({t=clone(PROG)}); destruct(t); o=({});]]); + test_do(add_constant("PROG"))      // - Array.diff   test_equal(Array.diff(({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }),    ({ 6, 7, 8, 9, 3, 4, 5, 1, 2, 0 })),    ({ ({ ({ 0, 1, 2, 3, 4, 5 }),    ({ 6, 7, 8, 9 }), ({}) }),    ({ ({}), ({ 6, 7, 8, 9 }),    ({ 3, 4, 5, 1, 2, 0 }) }) }))   test_equal(Array.diff(({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }),    ({ 9, 7, 8, 4, 5, 6, 0, 1, 2, 3 })),
pike.git/src/testsuite.in:8248:    ({"A","B","C","D","E","F","G","H"}))]],"AHD")   test_eq([[replace("1264412124",({"126","124","12","122","1260"}),    ({"13333","13335","883","13329","226709"}))]],"133334488313335")   test_eq(replace("foobargazonk","o","-"),"f--bargaz-nk")   test_eq(replace("foobargazonk",({"o","a"}),({"()","<>"})),"f()()b<>rg<>z()nk")   test_eq(replace("f--barf--",({"f--","f--bar"}),({"f--bar","f--"})),"f--f--bar")   test_eq(replace("f--barf--",({"f--bar","f--"}),({"f--","f--bar"})),"f--f--bar")   test_eq(replace("test\ntest\n\ntest\ntest",({"\n","\n\n"}),({" ","<p>"})),"test test<p>test test")   test_eq(replace("test\ntest\n\ntest\ntest",({"\n\n","\n"}),({"<p>"," "})),"test test<p>test test")   test_eq(replace("\xfffffff0", ({ "\xfffffff0" }), ({ "" })), "") + test_eq([[ replace("abcdefg", ([ "a":"x", "d":"y", "h":"z" ])) ]], "xbcyefg")      test_eq("123\000456""890"-"\0", "123\456""890")   test_eq("123\456000""890"-"\0", "123\456000""890")      test_any([[    array a=({ 1 });    replace(a,1,2);    return a[0];   ]], 2)   
pike.git/src/testsuite.in:8500:   test_search3($1,($1[..strlen($1)-3]))   test_search3($1,($1[1..]))   ]])      dnl some m4's don't handle 8 bit characters...   test_search4("SUNE")   test_search4("kapit\344l>")   test_search4("-------------------+")   test_search4("\345-------------------")   test_search4(sprintf("%'argel-bargel glop-glyf?'2000n")) -  - dnl these can be uncommented when sprintf handles wide strings +    test_search4("\34567-------------------")   test_search4("\345677777-------------------")   test_search4("kapit\3333l>")   test_search4("kapit\3333333l>")         // - sprintf   test_eq(sprintf("%.1f",31415.9267),"31415.9")   test_eq(sprintf("%.0f",31415.9267),"31416")   test_eq(sprintf("%.-1f",31415.9267),"31420")
pike.git/src/testsuite.in:8526:   test_eq(sprintf("%t", ({"a"})), "array")   test_any([[array(string) a = ({"a"}); return sprintf("%t", a);]], "array")   test_eq(sprintf("%t", 0), "int")   test_any([[array(string) a = 0; return sprintf("%t", a);]], "int")      // - sizeof   test_eq(sizeof("felbar"),6)   test_eq(sizeof(({"fulbar","gazonk",7})),3)   test_eq(sizeof(([8:3,6:6,7:0])),3)   test_eq(sizeof((<8,7,6,5,4,7>)),6) + test_eq([[ sizeof( class { int _sizeof() { return 17; } }() ) ]], 17)      // - sleep   test_do(sleep(1))   test_do(sleep(0.5))   test_any([[int x=time(); sleep(2); return x!=time()]],1)   test_any([[int x=time(); sleep(2); return x!=time()]],1)      // - string_to_unicode, unicode_to_string   test_eq(string_to_unicode("foo"), "\0f\0o\0o")   test_eq(string_to_unicode("blä"), "\0b\0l\0ä")