diff --git a/src/multiset.c b/src/multiset.c index bc70ad1571b810873ddf211ac6dfd45f19fc3c15..5ac958851f920f630b44c101daf32f1a9c34c6e7 100644 --- a/src/multiset.c +++ b/src/multiset.c @@ -2834,7 +2834,6 @@ PMOD_EXPORT struct multiset *merge_multisets (struct multiset *a, { INTERNAL_CMP (&a_ind, &b_ind, cmp_res); - if (cmp_res == CMPFUN_UNORDERED) cmp_res = 0; }, { /* Copy m.a_node. */ @@ -2882,7 +2881,6 @@ PMOD_EXPORT struct multiset *merge_multisets (struct multiset *a, { INTERNAL_CMP (&a_ind, &b_ind, cmp_res); - if (cmp_res == CMPFUN_UNORDERED) cmp_res = 0; }, { /* Copy m.a_node. */ diff --git a/src/testsuite.in b/src/testsuite.in index 4e69fc128fa1c13d9545d772c4038ddc9c375371..436f25f621f709d4e986d3a252e828f9faa4fe68 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -5650,8 +5650,19 @@ test_any_equal([[ ]], [[({4, 4, 5})]]) test_do(add_constant("cnt");) - test_eq([[sizeof(mtest_m2)]],sizeof(mtest_i2)) + +test_any([[ + // Test subtraction of multisets of objects. + class X(int a) + { + protected int `<(mixed o) { return objectp(o) && (a < o->a); } + protected int `==(mixed o) { return objectp(o) && (a == o->a); } + }; + multiset m = (< @map(allocate(5), X) >); + return sizeof(m - (<0>)); +]], 5) + test_any([[int e;multiset q=(<>),p=(<>); for(e=0;e<1000;e++) { p[reverse(e)]=1; q+=(<reverse(e)>); if(!equal(sort(indices(p)),sort(indices(q)))) return 0; } return 1;]],1) test_equal(sort(indices(mtest_m|mtest_m2)),sort(mtest_i|mtest_i2))