Macaulay2 Engine
Loading...
Searching...
No Matches

◆ testCoerceToLongInteger()

template<typename RT>
void testCoerceToLongInteger ( const RT & R)

Definition at line 74 of file ARingZZpTest.cpp.

75{
76 long top1 = (R.characteristic() > 10000 ? 10000 : R.characteristic());
77 long bottom2 = (R.characteristic() > 10000 ? R.characteristic() - 10000 : 0);
78 for (long i = 0; i < top1; i++)
79 {
80 typename RT::ElementType a;
81 R.init(a);
82 R.set_from_long(a, i);
83 long b = R.coerceToLongInteger(a);
84 if (b < 0) b += R.characteristic();
85 EXPECT_EQ(b, i);
86 }
87 for (long i = bottom2; i < R.characteristic(); i++)
88 {
89 typename RT::ElementType a;
90 R.init(a);
91 R.set_from_long(a, i);
92 long b = R.coerceToLongInteger(a);
93 if (b < 0) b += R.characteristic();
94 EXPECT_EQ(b, i);
95 }
96}

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().