1----------------------------------------------------------------------- 2-- double evaluation: https://cocoa.dima.unige.it/redmine/issues/946 3----------------------------------------------------------------------- 4TestCount := 0; 5PrintInfo := false; 6 7define TEST_ASSERT(A,B) 8 toplevel TestCount; 9 toplevel PrintInfo; 10 TestCount := TestCount+1; 11 If A<>B Then 12 error("TEST: " + Sprint(A) + " <> " + Sprint(B)); 13 endif; 14 if PrintInfo then print "."; EndIf; 15enddefine; -- TEST_ASSERT 16 17use R ::= QQ[x]; 18define f(x) 19 TopLevel COUNT; 20 incr(ref COUNT); 21 return x; 22enddefine; -- f 23 24COUNT := 0; 25I1 := ideal(R, GBasis(ideal(R, [f(x)]))); -- was OK 26TEST_ASSERT(COUNT, 1); 27 28COUNT := 0; 29I1 := ideal(GBasis(ideal([f(x)]))); -- used to give 4 30TEST_ASSERT(COUNT, 1); 31 32COUNT := 0; 33I1 := ideal(GBasis(ideal(f(x),x,x))); -- used to give 4 34---- TEST_ASSERT(COUNT, 1); 35 36COUNT := 0; 37I1 := len([f(x)]); -- used to give 4 38TEST_ASSERT(COUNT, 1); 39 40COUNT := 0; 41I1 := syz([f(x)]); -- used to give 2 42TEST_ASSERT(COUNT, 1); 43 44COUNT := 0; 45I1 := homog([f(x)], x); -- used to give 4 46TEST_ASSERT(COUNT, 1); 47 48COUNT := 0; 49I1 := gcd([f(x),x]); -- used to give 2 50TEST_ASSERT(COUNT, 1); 51