pike.git
/
src
/
testsuite.in
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/testsuite.in:7608:
int a() { function f = ff(); int s = Pike.count_memory (0, f()); f = 0; gc(); return s > 0; } ]])
+
// Pike.identify_cycle
+
test_any_equal([[
+
class Foo { Foo next; int counter; };
+
array(Foo) foos = allocate(10, Foo)();
+
for (int i = 0; i < 10; i++) {
+
foos[i]->next = foos[(i+1)%10];
+
foos[i]->counter = i;
+
}
+
return Pike.identify_cycle(foos[0])->counter;
+
]], ({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }))
+
test_any([[
+
// PIKE-106: Mutex not unlocked properly on error in identify_cycle().
+
class Foo {
+
int cnt;
+
int __hash() { return 0; }
+
int `==(mixed x) { if (!cnt++) error("Comparison failure.\n"); }
+
};
+
catch {
+
// This triggered an error.
+
Pike.identify_cycle(allocate(2, Foo)());
+
};
+
catch {
+
// This hanged due to the mc_mutex not having been released.
+
Pike.identify_cycle(allocate(2, Foo)());
+
};
+
]], 0)
+
// Numerical limits. test_true([[Int.NATIVE_MIN <= -2147483648]]) test_true([[Int.NATIVE_MAX >= 2147483647]]) test_true([[Float.DIGITS_10 >= 6]]) test_true([[Float.MIN_10_EXP <= -37]]) test_true([[Float.MAX_10_EXP >= 37]]) test_true([[Float.MIN <= 1e-37]]) test_true([[Float.MAX >= 1e37]]) test_true([[Float.EPSILON <= 1e-5]]) test_true([[1 <= 1.0]])