3 int test_I_ash (int iterations)
7 // Check against "*" and floor1.
8 for (i = iterations; i > 0; i--) {
9 cl_I a = testrandom_I();
10 uintL b = random32() % 1024;
12 for (uintL j = 0; j < b; j++)
14 ASSERT1(ash(1,(sintL)b) == pow2, b);
15 ASSERT1(ash(1,(cl_I)b) == pow2, b);
16 ASSERT2(ash(a,(sintL)b) == a*pow2, a,b);
17 ASSERT2(ash(a,-(sintL)b) == floor1(a,pow2), a,b);
19 // Check homomorphism w.r.t. second argument.
20 for (i = iterations; i > 0; i--) {
21 cl_I a = testrandom_I();
22 sintL b = random32() % 1024;
23 sintL c = random32() % 1024;
24 ASSERT3(ash(ash(a,b),c) == ash(a,b+c), a,b,c);
25 ASSERT3(ash(ash(a,b),-c) == ash(a,b-c), a,b,c);
26 ASSERT3(ash(ash(a,-b),-c) == ash(a,-b-c), a,b,c);
28 // Check against each other.
29 for (i = iterations; i > 0; i--) {
30 cl_I a = testrandom_I();
31 uintL b = random32() % 1024;
32 ASSERT2(ash(a,(cl_I)b) == ash(a,(sintL)b), a,b);
33 ASSERT2(ash(a,-(cl_I)b) == ash(a,-(sintL)b), a,b);