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

◆ testRingNegateRR()

void testRingNegateRR ( const M2::ARingRR & R,
int ntrials )

Definition at line 86 of file ARingRRTest.cpp.

87{
90 R.init(a);
91 R.init(b);
92 R.init(c);
93 for (int i = 0; i < ntrials; i++)
94 {
95 // test: (-a) + (a) == 0
96 gen.nextElement(a);
97 R.negate(b, a);
98 R.add(c, a, b);
99 EXPECT_TRUE(R.is_zero(c));
100 }
101 R.clear(c);
102 R.clear(b);
103 R.clear(a);
104}
const int ntrials
Definition ARingTest.hpp:42
void init(ElementType &result) const
Definition aring-RR.hpp:124
elem ElementType
Definition aring-RR.hpp:68
bool is_zero(const ElementType &f) const
Definition aring-RR.hpp:86
void negate(ElementType &result, const ElementType &a) const
Definition aring-RR.hpp:168
static void clear(ElementType &result)
Definition aring-RR.hpp:128
void add(ElementType &result, const ElementType &a, const ElementType &b) const
Definition aring-RR.hpp:175

References M2::ARingRR::add(), M2::ARingRR::clear(), M2::ARingRR::init(), M2::ARingRR::is_zero(), M2::ARingRR::negate(), ARingElementGenerator< RingType >::nextElement(), and ntrials.

Referenced by TEST().