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

◆ testRingNegateRRR()

void testRingNegateRRR ( const M2::ARingRRR & R,
int ntrials )

Definition at line 89 of file ARingRRRTest.cpp.

90{
93 R.init(a);
94 R.init(b);
95 R.init(c);
96 for (int i = 0; i < ntrials; i++)
97 {
98 // test: (-a) + (a) == 0
99 gen.nextElement(a);
100 R.negate(b, a);
101 R.add(c, a, b);
102 EXPECT_TRUE(R.is_zero(c));
103 }
104 R.clear(c);
105 R.clear(b);
106 R.clear(a);
107}
const int ntrials
Definition ARingTest.hpp:42
void negate(ElementType &result, const ElementType &a) const
bool is_zero(const ElementType &f) const
Definition aring-RRR.hpp:96
static void clear(ElementType &result)
void init(ElementType &result) const
void add(ElementType &result, const ElementType &a, const ElementType &b) const

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

Referenced by TEST().