pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2003-04-27
2003-04-27 17:51:58 by Martin Stjernholm <mast@lysator.liu.se>
6ec0198d07928e9e1eb80cf99dfb3582289d3456 (
34
lines) (+
31
/-
3
)
[
Show
|
Annotate
]
Branch:
7.9
Test that sort() is stable.
Rev: src/testsuite.in:1.637
1:
-
test_true([["$Id: testsuite.in,v 1.
636
2003/04/
10
19
:
48
:
13
nilsson
Exp $"]]);
+
test_true([["$Id: testsuite.in,v 1.
637
2003/04/
27
17
:
51
:
58
mast
Exp $"]]);
// This triggered a bug only if run sufficiently early. test_compile_any([[#pike 7.2]])
3197:
class c1 { inherit p1; inherit p2; }; return c1()->foo();]],2)
-
test_any([[class foo { int x=random(100); int `<(object o) { return x < o->x; } }; array(object) o=allocate(100,foo)(); sort(o); for(int e=1;e<100;e++) if(o[e-1]->x > o[e]->x) return e; return -1;]],-1)
-
+
test_any([[ mixed ret=({}); int a, b = 3;
9006:
dnl 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}))
+
test_any_equal([[
+
// sort() on one arg should be stable.
+
class C (int id) {int `< (mixed x) {return 0;}};
+
return sort (({C(2), C(6), C(1), C(4), C(3), C(5)}))->id;
+
]], ({2, 6, 1, 4, 3, 5}))
+
test_any_equal([[
+
// sort() on several args should be stable.
+
array a = ({2, 6, 1, 4, 3, 5});
+
sort (({1, 1, 1, 1, 1, 1}), a);
+
return a;
+
]], ({2, 6, 1, 4, 3, 5}))
+
test_any_equal([[
+
// sort() on several args should be stable.
+
array a = ({2, 6, 1, 4, 3, 5});
+
sort (({1, 2, 1, 2, 1, 2}), a);
+
return a;
+
]], ({2, 1, 3, 6, 4, 5}))
+
test_any([[
+
class foo {
+
int x=random(100);
+
int `<(object o) {return x < o->x;}
+
};
+
array(object) o=allocate(100,foo)();
+
sort(o);
+
for(int e=1;e<100;e++)
+
if(o[e-1]->x > o[e]->x)
+
return e;
+
return -1;
+
]],-1)
dnl missing tests for objects, arrays, multisets and mappings // - sprintf