diff --git a/src/testsuite.in b/src/testsuite.in index b210639168b8dc67cf006409d2d9a48713223bc2..0329074ba24bf0c0ab4d1c6f05138189880e7954 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -test_true([["$Id: testsuite.in,v 1.325 2000/09/01 20:19:35 hubbe Exp $"]]); +test_true([["$Id: testsuite.in,v 1.326 2000/09/03 23:22:16 mast Exp $"]]); cond([[all_constants()->_verify_internals]], [[ @@ -1815,6 +1815,20 @@ test_any([[mapping m=([1:2,3:2]); return search(m,2,search(m,2))!=-1;]],1) test_any([[mapping m=([]); for(int e=0;e<1000;e++) m[e&3]+=({e}); return sizeof(m)==4 && sizeof(m[0])==250;]],1) +// destructed indices +test_any([[{ + object o = class{}(); + mapping m = ([o: 1]); + destruct (o); + return equal (m, ([])) && equal (m, ([])); +}]], 1) +test_any([[{ + object o = class{}(); + mapping m = ([o: 1]), n = ([class{}(): 1]); + destruct (o); + return !equal (m, n) && !equal (m, n); +}]], 1) + // 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})]]) @@ -2092,6 +2106,54 @@ ifefun(gc, return gc() + gc() >= 3; }]], 1); + test_do([[{ + mapping a = ([1:({17}),2:3,4:5,6:7,8:9]), b = a + ([]); + set_weak_flag (b, 1); + gc(); + }]]); + test_do([[{ + mapping a = ([1:({17})]), b = a + ([]); + set_weak_flag (b, 1); + gc(); + }]]); + test_any([[{ + mapping a = ([17:({17})]); + for (int i = 0; i < 10; i++) a[class{}()] = i; + mapping b = a + ([]); + set_weak_flag (b, 1); + foreach (indices (a), mixed o) if (objectp (o)) destruct (o); + gc(); + return sizeof (a) == 1 && sizeof (b) == 1; + }]], 1); + test_any([[{ + mapping a = ([17:({17})]); + for (int i = 0; i < 10; i++) a[class{}()] = i; + mapping b = a + ([]); + set_weak_flag (a, 1); + foreach (indices (a), mixed o) if (objectp (o)) destruct (o); + gc(); + return sizeof (a) == 1 && sizeof (b) == 1; + }]], 1); + test_any([[{ + mapping a = ([17:({17})]); + for (int i = 0; i < 10; i++) a[class{}()] = i; + mapping b = a + ([]); + set_weak_flag (a, 1); + set_weak_flag (b, 1); + foreach (indices (a), mixed o) if (objectp (o)) destruct (o); + gc(); + return !sizeof (a) && !sizeof (b); + }]], 1); + test_any([[{ + mapping a = ([17:({17})]); + set_weak_flag (a, 1); + for (int i = 0; i < 10; i++) a[class{}()] = i; + mapping b = a + ([]); + foreach (indices (a), mixed o) if (objectp (o)) destruct (o); + gc(); + return sizeof (a) == 1 && sizeof (b) == 1; + }]], 1); + test_do([[{ int got_error = 0; array(string) destruct_order;