pike.git / lib / modules / ADT.pmod / testsuite.in

version» Context lines:

pike.git/lib/modules/ADT.pmod/testsuite.in:1: - dnl $Id: testsuite.in,v 1.5 2002/10/19 14:21:35 nilsson Exp $ + dnl $Id: testsuite.in,v 1.6 2003/01/03 23:20:14 nilsson Exp $      dnl - ADT.History      test_eq(sizeof(ADT.History(2)),0)      test_do(add_constant("adth", ADT.History(2)))   test_eq(adth->get_maxsize(),2)   test_any([[    adth->push(17);    return sizeof(adth);
pike.git/lib/modules/ADT.pmod/testsuite.in:140:      test_any([[    object s = ADT.Stack();    s->set_stack( "1234"/1 );    object t = ADT.Stack();    t->push("5");    return values(s+t)*"";   ]], "12345")       + dnl - ADT.Struct +  + test_do([[ +  class Test { +  inherit ADT.Struct; +  Item one = Byte(); +  Item two = Word(2); +  Item three = Chars(3); +  }; +  add_constant("Test", Test); + ]]) + test_equal( sizeof(Test()), 6 ) + test_equal( indices(Test()), ({ "one", "two", "three" }) ) + test_equal( values(Test()), ({ 0, 2, "\0\0\0" }) ) + test_eq( (string)Test("123456"), "123456" ) + test_eq( (string)Test("1234567"), "123456" ) + test_equal( (array)Test("123456"), ({ "1", "23", "456" }) ) + test_any([[ +  Test test=Test(); +  test->one=1; +  test->two=3; +  test->three="klm"; +  return (string)test; + ]], "\1\0\3klm") + test_any([[ +  Test test=Test(); +  test["one"]=1; +  test["two"]=3; +  test["three"]="klm"; +  return (string)test; + ]], "\1\0\3klm") + test_any([[ +  Test test=Test(); +  return sprintf("%O%O%O", test->one, test->two, test->three); + ]], "02\"\\0\\0\\0\"") + test_any([[ +  Test test=Test(); +  return sprintf("%O%O%O", test["one"], test["two"], test["three"]); + ]], "02\"\\0\\0\\0\"") + test_any([[ +  Test test=Test(); +  test->decode("123456"); +  return test->encode(); + ]], "123456") + test_eval_error([[ +  Test test=Test(); +  test->one=-1; + ]]) + test_eval_error([[ +  Test test=Test(); +  test->one=256; + ]]) + test_eval_error([[ +  Test test=Test(); +  test->two=-1; + ]]) + test_eval_error([[ +  Test test=Test(); +  test->two=65536; + ]]) + test_eval_error([[ +  Test test=Test(); +  test->three=""; + ]]) + test_eval_error([[ +  Test test=Test(); +  test->three="xx\0777"; + ]]) + test_do( add_constant("Test") ) + test_do([[ +  class Test { +  inherit ADT.Struct; +  }; +  add_constant( "Test", Test ); + ]]) + test_equal( sizeof(Test()), 0 ) + test_equal( indices(Test()), ({}) ) + test_equal( values(Test()), ({}) ) + test_equal( (string)Test(), "" ) + test_do( Test()->decode("123") ) + test_do( Test()->decode("") ) + test_do( add_constant("Test") ) + test_any([[ +  class Test { +  inherit ADT.Struct; +  Item one = Byte(1); +  Item two = Word(); +  Item three = Chars(3, "klm"); +  }; +  return (string)Test(); + ]], "\1\0\0klm") +  +    dnl - ADT.Table      test_true(ADT.Table.table(    ({ ({ "a", "b", 42 }),    ({ "c", "b", 41 }),    ({ "a", "a", 76 }) }),    ({ "X", "Y", "z" }))->select("x", 2)->sum("Z")->distinct(0)->rsort("X")    ->rename(0, "fOo")->sort("foO")->cast("array"),    ({ ({ "a", 118 }),    ({ "c", 41 }) }))