Branch: Tag:

2008-10-04

2008-10-04 19:52:09 by Martin Stjernholm <mast@lysator.liu.se>

New and adjusted Pike.count_memory tests.

Rev: src/testsuite.in:1.856

1:   START_MARKER - test_true([["$Id: testsuite.in,v 1.855 2008/09/15 14:53:57 grubba Exp $"]]); + test_true([["$Id: testsuite.in,v 1.856 2008/10/04 19:52:09 mast Exp $"]]);      // This triggered a bug only if run sufficiently early.   test_compile_any([[#pike 7.2]])
6200:      // Pike.count_memory   // time(1) is used below to avoid constants with extra refs. - test_true([[Pike.count_memory (0, ({})) == 0]]) + test_true([[Pike.count_memory (0) == 0]]) + test_true([[Pike.count_memory (0, ({})) > 0]])   test_true([[Pike.count_memory (0, ({time(1)})) > 0]]) - test_true([[Pike.count_memory (0, (<time(1)>)) > 0]]) + test_true([[Pike.count_memory (0, (<>)) > 0]])   test_true([[Pike.count_memory (0, (<time(1)>)) > -  +  Pike.count_memory (0, (<>))]]) + test_true([[Pike.count_memory (0, (<time(1)>)) >    Pike.count_memory (0, (<1>))]]) - test_true([[Pike.count_memory (0, ([1: time(1)])) > 0]]) + test_true([[Pike.count_memory (0, ([])) > 0]])   test_true([[Pike.count_memory (0, ([1: time(1)])) > -  +  Pike.count_memory (0, ([]))]]) + test_true([[Pike.count_memory (0, ([1: time(1)])) >    Pike.count_memory (0, ([1: 2]))]])   test_true([[Pike.count_memory (0, class {}) > 0]]) -  + test_true([[Pike.count_memory (0, class {float f;}) > +  Pike.count_memory (0, class {})]]) + test_true([[Pike.count_memory (0, class {constant f = 0.0;}) > +  Pike.count_memory (0, class {})]])   test_true([[Pike.count_memory (0, class {}()) > 0]])   test_true([[Pike.count_memory (0, class {float f;}()) >    Pike.count_memory (0, class {}())]]) -  + test_true([[Pike.count_memory (0, class {constant f = 0.0;}()) == +  Pike.count_memory (0, class {}())]])   test_true([[Pike.count_memory (0, "foo") > 0]])   test_true([[Pike.count_memory (0, typeof (map)) > 0]])   test_true([[Pike.count_memory (0, 17) == 0]]) - test_true([[Pike.count_memory (0, ({"some string with no other ref in memory " + -  Standards.UUID.make_version4()->str()})) > + test_true([[Pike.count_memory (0, ({"some string with no other ref in memory "+ +  Standards.UUID.make_version4()->str()})) ==    Pike.count_memory (0, ({""}))]]) - test_true([[Pike.count_memory (0, class X {mapping(X:array(int)) x;}) > -  Pike.count_memory (0, class Y {int x;})]]) - test_true([[Pike.count_memory (0, ({compile ( + test_true([[Pike.count_memory (1, ({"some string with no other ref in memory " + +  Standards.UUID.make_version4()->str()})) > +  Pike.count_memory (1, ({""}))]]) + test_true([[Pike.count_memory (0, ({time(1)})) + +  Pike.count_memory (0, ([1: time(1)])) == +  Pike.count_memory (1, ({([1: time(1)])}))]]) + test_true([[Pike.count_memory (1, class X {mapping(X:array(int)) x;}) > +  Pike.count_memory (1, class Y {int x;})]]) + test_true([[Pike.count_memory (1, ({compile (    "constant x = ([1: time(1)]);")})) > -  Pike.count_memory (0, ({([1: time(1)])}))]]) +  Pike.count_memory (1, ({([1: time(1)])}))]])   test_any([[    array a1 = ({({time(1)})}), a2 = ({a1[0]}); -  return Pike.count_memory (0, a1, a2) > -  Pike.count_memory (0, a1) + Pike.count_memory (0, a2); +  return Pike.count_memory (1, a1, a2) > +  Pike.count_memory (1, a1) + Pike.count_memory (1, a2);   ]], 1)   test_any([[    mapping m = ([1: time(1)]); -  return Pike.count_memory (0, ({m})) == Pike.count_memory (0, ({0})); +  return Pike.count_memory (1, ({m})) == Pike.count_memory (1, ({0}));   ]], 1)   test_any([[    array a = ({([1: time(1)])}); -  return Pike.count_memory (0, a) > Pike.count_memory (0, ({([])})); +  return Pike.count_memory (1, a) > Pike.count_memory (1, ({([])}));   ]], 1)   test_any([[    program p = class {}; -  return Pike.count_memory (0, p) > Pike.count_memory (0, p()); +  return Pike.count_memory (1, p) > Pike.count_memory (1, p());   ]], 1)   test_any([[    class X (void|object a) {}; -  X o = X(); -  int size = Pike.count_memory (0, o); -  o->a = X(); -  return Pike.count_memory (0, o) > size; +  X o = X (X()); +  return Pike.count_memory (1, o) == Pike.count_memory (0, o) * 2;   ]], 1)   test_any([[    class X (void|object a) {};    X o = X (X (X())); -  int size = Pike.count_memory (0, o); +     o->a->a->a = o->a; -  return Pike.count_memory (3, o) == size; +  return Pike.count_memory (3, o) == Pike.count_memory (0, o) * 3;   ]], 1)   test_any([[    class X (void|object a) {};    X o = X (X (X()));    o->a->a->a = o->a; -  return Pike.count_memory (2, o) < Pike.count_memory (3, o); +  return Pike.count_memory (2, o) == Pike.count_memory (0, o);   ]], 1)   test_any([[    class X (void|object a) {};    X o = X (X (X())); -  int size = Pike.count_memory (0, o); +  int size = Pike.count_memory (1, o);    o->a->a->a = o->a;    return Pike.count_memory ((["lookahead": 3]), o) == size;   ]], 1)   test_any([[    class X (void|object a) {};    X o = X (X (X())); -  int size = Pike.count_memory (0, o); +  int size = Pike.count_memory (1, o);    return Pike.count_memory ((["lookahead": 3, "block_objects": 1]), o) == size;   ]], 1)   test_any([[    class X (void|object a) {};    X o = X (X (X())); -  int size = Pike.count_memory ((["block_objects": 1]), o); +  return Pike.count_memory ((["block_objects": 1]), o) == +  Pike.count_memory (1, o); + ]], 1) + test_any([[ +  class X (void|object a) {}; +  X o = X (X (X()));    o->a->a->a = o->a; -  return Pike.count_memory ((["lookahead": 3, "block_objects": 1]), o) < size; +  return Pike.count_memory ((["lookahead": 3, "block_objects": 1]), o) == +  Pike.count_memory (0, o);   ]], 1)   test_any([[    class X (void|object a) {};    X o = X (X (X())); -  int size = Pike.count_memory (0, o); +     o->a->a->a = o->a;    X r = o->a->a; -  return Pike.count_memory (10, o) < size; +  return Pike.count_memory (10, o) == Pike.count_memory (0, o);   ]], 1)   test_any([[    class X (void|object a) {};    X o = X (X (X()));    o->a->a->a = o->a; -  +  X r = o->a; +  return Pike.count_memory (3, o) == Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a) {}; +  X o = X (X (X())); +  o->a->a->a = o->a;    X r = o->a->a; -  int size = Pike.count_memory (3, o); -  r = o->a; -  return Pike.count_memory (3, o) == size; +  return Pike.count_memory (3, o) == Pike.count_memory (0, o);   ]], 1)   test_any([[    class X (void|object a, void|object b) {}; -  +  X o = X (X (X (X (X (X ()))))); +  o->a->b = o; +  o->a->a->b = o->a; +  o->a->a->a->b = o->a->a; +  o->a->a->a->a->b = o->a->a->a; +  o->a->a->a->a->a->b = o->a->a->a->a; +  return Pike.count_memory (2, o) == Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a, void|object b) {}; +  X o = X (X (X (X (X (X ()))))); +  o->a->b = o; +  o->a->a->b = o->a; +  o->a->a->a->b = o->a->a; +  o->a->a->a->a->b = o->a->a->a; +  o->a->a->a->a->a->b = o->a->a->a->a; +  return Pike.count_memory (3, o) == 6 * Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a, void|object b) {}; +  X o = X (X (X (X (X (X ()))))); +  o->a->b = o; +  o->a->a->b = o->a; +  o->a->a->a->b = o->a->a; +  o->a->a->a->a->b = o->a->a->a; +  o->a->a->a->a->a->b = o->a->a->a->a; +  X p = o->a->a->a->a; +  return Pike.count_memory (3, o) == Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a, void|object b) {constant pike_cycle_depth = 2;}; +  X o = X (X (X (X (X (X ()))))); +  o->a->b = o; +  o->a->a->b = o->a; +  o->a->a->a->b = o->a->a; +  o->a->a->a->a->b = o->a->a->a; +  o->a->a->a->a->a->b = o->a->a->a->a; +  return Pike.count_memory (1, o) == 6 * Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a, void|object b) {constant pike_cycle_depth = 1;}; +  X o = X (X (X (X (X (X ()))))); +  o->a->b = o; +  o->a->a->b = o->a; +  o->a->a->a->b = o->a->a; +  o->a->a->a->a->b = o->a->a->a; +  o->a->a->a->a->a->b = o->a->a->a->a; +  return Pike.count_memory (1, o) == Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a, void|object b) {constant pike_cycle_depth = 0;}; +  X o = X (X (X (X (X (X ()))))); +  o->a->b = o; +  o->a->a->b = o->a; +  o->a->a->a->b = o->a->a; +  o->a->a->a->a->b = o->a->a->a; +  o->a->a->a->a->a->b = o->a->a->a->a; +  return Pike.count_memory (3, o) == Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a, void|object b) {constant pike_cycle_depth = 2;}; +  X o = X (X (X (X (X (X ()))))); +  o->a->b = o; +  o->a->a->b = o->a; +  o->a->a->a->b = o->a->a; +  o->a->a->a->a->b = o->a->a->a; +  o->a->a->a->a->a->b = o->a->a->a->a; +  return Pike.count_memory ((["block_pike_cycle_depth": 1]), o) == +  Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a, void|object b) {};    X o = X (X (X()));    o->a->a->a = o->a;    X o2 = X();    o->b = o2;    o2->a = o->a->a; -  int size = Pike.count_memory (3, o); +     o2 = 0; -  return Pike.count_memory (3, o) > size; +  return Pike.count_memory (3, o) == 4 * Pike.count_memory (0, o);   ]], 1)   test_any([[    class X (void|object a, void|object b) {}; -  +  X o = X (X (X())); +  o->a->a->a = o->a; +  X o2 = X(); +  o->b = o2; +  o2->a = o->a->a; +  return Pike.count_memory (3, o) == Pike.count_memory (0, o); + ]], 1) + test_any([[ +  class X (void|object a, void|object b) {};    X o = X (X(), X());    o->a->b = o->b;    o->b->a = o->a; -  int size = Pike.count_memory (3, o); +     o->a->a = o->b->b = X(); -  return Pike.count_memory (3, o) > size; +  return Pike.count_memory (3, o) == 4 * Pike.count_memory (0, o);   ]], 1)   test_any([[    class X (void|object a, void|object b) {};
6328:    o2->a->a = o2->b->b = X();    o->a->a = o->b->b = o2;    o2 = 0; -  mapping m = (["lookahead": 3, "collect_stats": 1]); +  mapping m = (["lookahead": 2, "collect_stats": 1]);    Pike.count_memory (m, o); -  return m->rounds == 3 && m->max_distance == 2; +  return m->rounds == 2 && m->internal == 7;   ]], 1) -  + test_any([[ +  mixed r = ([]), p = r; +  p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = 0; +  return Pike.count_memory (2, r) == Pike.count_memory (0, r); + ]], 1) + test_any([[ +  mixed r = ([]), p = r; +  p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = 0; +  return Pike.count_memory (3, r) == 6 * Pike.count_memory (0, r); + ]], 1) + test_any([[ +  mixed r = ([]), p = r; +  p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = p->next; p->next = ([]); p->next->prev = p; +  p = 0; +  return Pike.count_memory ((["lookahead": 3, "return_count": 1]), r); + ]], 6)   test_true([[Pike.count_memory (Int.NATIVE_MAX, ({master()})) ==    Pike.count_memory (0, ({0}))]])   test_do([[
6343:   cond([[has_value (cpp ("__AUTO_BIGNUM__"), "1")]], [[    test_true([[Pike.count_memory (0, Int.NATIVE_MAX + 1) >    Pike.count_memory (0, 17)]]) -  test_true([[Pike.count_memory (0, Int.NATIVE_MAX * Int.NATIVE_MAX) > -  Pike.count_memory (0, Int.NATIVE_MAX)]]) +  test_true([[Pike.count_memory (0, Int.NATIVE_MAX << 100) > +  Pike.count_memory (0, Int.NATIVE_MAX + 1)]])   ]])      // Numerical limits.