Branch: Tag:

2003-01-15

2003-01-15 22:16:48 by Martin Nilsson <mani@lysator.liu.se>

A few more tests.

Rev: src/testsuite.in:1.587

1: - test_true([["$Id: testsuite.in,v 1.586 2003/01/15 19:07:15 mast Exp $"]]); + test_true([["$Id: testsuite.in,v 1.587 2003/01/15 22:16:48 nilsson Exp $"]]);      // This triggered a bug only if run sufficiently early.   test_compile_any([[#pike 7.2]])
528:   return mktime(32, 38, 9, 15, 9, 102, 0, 0);   ]], 1034674712)    + cond( [[ master()->resolv("Pike")->Security ]],[[   test_any( [[   // bug [2830] ------------------------------------------------------------   // http://community/crunch/show_bug.cgi?id=2830
535:      object luser = User();    - #if constant(Pike.Security) +     object luser_creds = Pike.Security.Creds(luser, 0, 0);    return !catch {    return !!call_with_creds(luser_creds, Stdio.File, "/dev/null");    }; - #endif +     return 0;    ]], 0 ) -  + ]])      test_any( [[   // bug [1996] ------------------------------------------------------------
3358:   test_true([[ ("foobar"/"o") & ({ "foo" }) ]])   test_any([[ array a="foo bar"/" "; return sizeof(a & ({"foo"}))]],1)    - // glob - test_false(glob("foo","bar")) - test_true(glob("foo","foo")) - test_true(glob("f?o","foo")) - test_true(glob("f??","foo")) - test_true(glob("?o?","foo")) - test_true(glob("f*","foo")) - test_true(glob("*o","foo")) - test_true(glob("*<<<*","<<<")) - test_true(glob("*<<<*","<<<foo")) - test_false(glob("*f","foo")) - test_false(glob("o*","foo")) - test_false(glob("?f?","foo")) - test_equal([[glob("?f?",({"ff","ffff","off","fff",""}))]],[[({"off","fff"})]]) - test_equal([[glob("foo*bar",({"foobar","foobargazonk","","foofoobar","fobar","fooar"}))]],[[({"foobar","foofoobar"})]]) -  - // localtime - cond([[all_constants()->localtime]], - [[ - test_true(mappingp(localtime(0))) - ]]) -  - cond([[all_constants()->mktime]], - [[ -  test_true([[mktime( ([ -  "sec":58, -  "isdst":1, -  "year":98, -  "mon":3, -  "mday":26, -  "hour":1, -  "min":51 - ]))]]) -  -  test_eq([[mktime(58,51,1,26,3,98,1,0)]],[[mktime( ([ -  "sec":58, -  "isdst":1, -  "year":98, -  "mon":3, -  "mday":26, -  "hour":1, -  "min":51, -  "timezone":0, - ]) ) ]]) -  - ]]) -  - cond([[all_constants()->localtime && all_constants()->mktime]], - [[ -  test_any([[int x=time(); return mktime(localtime(x)) == x;]], 1) -  test_any([[int x=time(); for(int y=0;y<100;y++) if(mktime(localtime(x+y)) != x+y) return x+y; return 0;]], 0) - ]]) -  - test_do([[int t = -1; catch(localtime(t));]]) - test_do([[int t = -1; catch(gmtime(t));]]) - test_do([[int t = -1; catch(ctime(t));]]) -  +    cond([[all_constants()->_verify_internals]],   [[    test_do(_verify_internals())   ]])    - // sort - test_equal(sort(({1,3,2,4})),({1,2,3,4})) - test_equal(sort(({4,3,2,1})),({1,2,3,4})) - test_equal([[lambda() {array(int) a=({1,2,3,4}); sort(({4,3,2,1}),a); return a; }()]],[[({4,3,2,1})]] ) - test_equal([[lambda() {array(int) a=({1,2,3,4}), b=a+({}); sort(({4,3,2,1}),a,b); return b; }()]],[[({4,3,2,1})]] ) -  +    cond([[all_constants()->thread_create]],   [[   // thread_create
3633:   test_any([[mapping a=([1:1]); return m_delete(a,1)]],1)   test_any([[mapping m=([]); m[1]++; return m[1];]],1)   test_any([[mapping m=([1:1]); m[1]++; return m[1];]],2) + test_any([[mapping m=([1:1]); m[1]++; return m[1]++;]],2)   test_any([[mapping m=([]); m[1]++; m[1]++; return m[1];]],2)      // multiset tests
3999:    return sizeof (values (m)) || sizeof (m);   }]], 0)    - // rows - test_equal([[rows(({1,2,3,4,5,6,7,8,9}),({6,7,2}))]],[[({7,8,3})]]) - test_equal([[rows(({1,2,3,4,5,6,7,8,9}),({0,4,1}))]],[[({1,5,2})]]) - test_equal([[rows(({1,2,3,4,5,6,7,8,9}),({8,3,5}))]],[[({9,4,6})]]) -  - // column - test_equal([[column(({({1,2,3}),({5,6,7}),({8,9,0})}),0)]],[[({1,5,8})]]) - test_equal([[column(({({1,2,3}),({5,6,7}),({8,9,0})}),1)]],[[({2,6,9})]]) - test_equal([[column(({({1,2,3}),({5,6,7}),({8,9,0})}),2)]],[[({3,7,0})]]) -  -  +    // gc   ifefun(gc,   [[
7921:   // Tested in _math      // - add_constant + test_compile_error(int a=grunk(5);) + test_do(add_constant("grunk",abs)) + test_do(int a=grunk(5);) + test_do(add_constant("grunk")) + test_compile_error(int a=grunk(5);)      // - add_include_path   // - add_module_path
7948:   test_eq(all_constants()["all_constants"],all_constants)      // - all_threads + test_true(arrayp(all_threads())) + test_true(sizeof(all_threads())) + test_true(objectp(all_threads()[0]))      // - allocate   test_equal(allocate(0),({}))
7976:   // Tested in lib      // - basetype + test_eq(basetype(0),"int") + test_eq(basetype(0.0),"float") + test_eq(basetype(""),"string") + test_eq(basetype(({})),"array") + test_eq(basetype(({1})),"array") + test_eq(basetype((<>)),"multiset") + test_eq(basetype(([])),"mapping") + test_eq(basetype(class {}),"program") + test_eq(basetype(class {}()),"object") + test_eq(basetype(abs),"function") + test_eq(basetype(lambda(){}),"function") + test_eq(basetype(typeof(0)),"type")      // - call_function   test_eq(1,call_function(a))
8010:   clone(compile_string("int foo() { return 17; }"))->foo() ]],17)      // - closelog +    // - column -  + test_equal([[column(({({1,2,3}),({5,6,7}),({8,9,0})}),0)]],[[({1,5,8})]]) + test_equal([[column(({({1,2,3}),({5,6,7}),({8,9,0})}),1)]],[[({2,6,9})]]) + test_equal([[column(({({1,2,3}),({5,6,7}),({8,9,0})}),2)]],[[({3,7,0})]])      // - combine_path   test_eq([[combine_path("/foo/bar/gazonk/","..")]],"/foo/bar")
8155:      // - ctime   test_eq(ctime(0)[-1],'\n') + test_do([[int t = -1; catch(ctime(t));]])      // - decode_value   // - delay
8257:   // - getpwuid   // - getsid   // - getuid +    // - glob -  + test_false(glob("","a")) + test_false(glob("a","")) + test_false(glob("?","")) + test_true(glob("*","")) + test_false(glob("foo","bar")) + test_true(glob("foo","foo")) + test_true(glob("f?o","foo")) + test_true(glob("f??","foo")) + test_true(glob("?o?","foo")) + test_true(glob("f*","foo")) + test_true(glob("*o","foo")) + test_true(glob("*<<<*","<<<")) + test_true(glob("*<<<*","<<<foo")) + test_false(glob("*f","foo")) + test_false(glob("o*","foo")) + test_false(glob("?f?","foo")) + test_equal([[glob("?f?",({"ff","ffff","off","fff",""}))]],[[({"off","fff"})]]) + test_equal([[glob("foo*bar",({"foobar","foobargazonk","","foofoobar","fobar","fooar"}))]],[[({"foobar","foofoobar"})]]) +    // - gmtime -  + cond([[all_constants()->localtime && all_constants()->mktime]],[[ +  test_do([[int t = -1; catch(gmtime(t));]]) + ]]) +    // - hardlink      // - has_index
8331:      // - kill   // - load_module +    // - localtime -  + cond([[all_constants()->localtime]],[[ +  test_true(mappingp(localtime(0))) +  test_do([[int t = -1; catch(localtime(t));]]) + ]]) + cond([[all_constants()->localtime && all_constants()->mktime]], + [[ +  test_any([[int x=time(); return mktime(localtime(x)) == x;]], 1) +  test_any([[int x=time(); for(int y=0;y<100;y++) if(mktime(localtime(x+y)) != x+y) return x+y; return 0;]], 0) + ]])    -  +    // - log   // Tested in _math   
8442:   // - mkdir   // - mkmapping   // - mkmultiset +    // - mktime -  + cond([[all_constants()->mktime]], + [[ +  test_true([[mktime( ([ +  "sec":58, +  "isdst":1, +  "year":98, +  "mon":3, +  "mday":26, +  "hour":1, +  "min":51 + ]))]])    -  +  test_eq([[mktime(58,51,1,26,3,98,1,0)]],[[mktime( ([ +  "sec":58, +  "isdst":1, +  "year":98, +  "mon":3, +  "mday":26, +  "hour":1, +  "min":51, +  "timezone":0, + ]) ) ]]) +  + ]]) +    // - multisetp   // Tested in foop   
8646:   // Tested in _math      // - rows + test_equal([[rows(({1,2,3,4,5,6,7,8,9}),({6,7,2}))]],[[({7,8,3})]]) + test_equal([[rows(({1,2,3,4,5,6,7,8,9}),({0,4,1}))]],[[({1,5,2})]]) + test_equal([[rows(({1,2,3,4,5,6,7,8,9}),({8,3,5}))]],[[({9,4,6})]])      // - search   test_eval_error(return search("foolbar","o",-10))
8804:   test_any([[int x=time(); sleep(2); return x!=time()]],1)      // - sort + test_equal(sort(({1,3,2,4})),({1,2,3,4})) + test_equal(sort(({4,3,2,1})),({1,2,3,4})) + test_equal([[lambda() {array(int) a=({1,2,3,4}); sort(({4,3,2,1}),a); return a; }()]],[[({4,3,2,1})]] ) + test_equal([[lambda() {array(int) a=({1,2,3,4}), b=a+({}); sort(({4,3,2,1}),a,b); return b; }()]],[[({4,3,2,1})]] ) + test_equal([[sort("a,A,å,Å,ä,*A,[A"/",")]],[["*A,A,[A,a,Å,ä,å"/","]]) + test_equal(sort(({})),({})) + test_equal(sort(({1.0,2.0,4.0,3.0})),({1.0,2.0,3.0,4.0})) + dnl missing tests for objects, arrays, multisets and mappings      // - sprintf   // Tested in sprintf
8812:   // Tested in _math      // - strerror + test_true(stringp(strerror(0))) + test_true(stringp(strerror(1))) + test_true(stringp(strerror(-1)))      // - string_to_unicode, unicode_to_string   test_eq(string_to_unicode("foo"), "\0f\0o\0o")