1 | LIB "tst.lib"; |
---|
2 | tst_init(); |
---|
3 | |
---|
4 | LIB("primdecint.lib"); |
---|
5 | |
---|
6 | ring rng=integer,( a,b,y(1),d ),dp; |
---|
7 | |
---|
8 | proc testRadicalZ() |
---|
9 | { |
---|
10 | ring rng=integer,( a,b,y(1),d ),dp; |
---|
11 | ideal j = 2*d,d^2,y(1)^2 - y(1)*d, b*y(1) - 2*d, a*b + y(1)*d; |
---|
12 | def result = Primdecint::radicalZ(j); |
---|
13 | } |
---|
14 | |
---|
15 | proc testRadicalZ_2() |
---|
16 | { |
---|
17 | ring rng = integer,(a,b,c),dp; |
---|
18 | ideal i = a^2*b^4 + c^2-1,4*a^2*b^3; |
---|
19 | def result = Primdecint::radicalZ(i); |
---|
20 | ideal expectedResult = 2*c^ 2-2, 2*a*b, a*b^2*c-a*b^ 2+c^2-1,a^2*b^3+a*b*c+a*b; |
---|
21 | ASSUME( 0, 0 == size( reduce(result,std(expectedResult) ) ) ); |
---|
22 | ASSUME( 0, 0 == size( reduce(expectedResult,std(result) ) ) ); |
---|
23 | } |
---|
24 | |
---|
25 | // the test fails, if inside of radicalZ will be an infinite loop |
---|
26 | link l1 = "ssi:fork"; open(l1); |
---|
27 | |
---|
28 | write( l1, quote(testRadicalZ_2()) ); |
---|
29 | waitfirst( list(l1), 2000); // waits 2 seconds. |
---|
30 | |
---|
31 | if (not (status(l1,"read")=="ready")) { ERROR("testRadicalZ_2 failed!"); } |
---|
32 | close(l1); |
---|
33 | kill l1; |
---|
34 | |
---|
35 | link l1 = "ssi:fork"; open(l1); |
---|
36 | |
---|
37 | write( l1, quote( testRadicalZ() ) ); |
---|
38 | waitfirst( list(l1), 2000); // waits 2 seconds. |
---|
39 | |
---|
40 | if (not (status(l1,"read")=="ready")) { ERROR("radicalZ() probably ended in an infinite loop!"); } |
---|
41 | close(l1); |
---|
42 | kill l1; |
---|
43 | |
---|
44 | tst_status(1); $ |
---|
45 | |
---|