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

◆ testRingNegateCCC()

void testRingNegateCCC ( const M2::ARingCC & C,
int ntrials )

Definition at line 76 of file ARingCCTest.cpp.

77{
80 C.init(a);
81 C.init(b);
82 C.init(c);
83 for (int i = 0; i < ntrials; i++)
84 {
85 // test: (-a) + (a) == 0
86 gen.nextElement(a);
87 C.negate(b, a);
88 C.add(c, a, b);
89 EXPECT_TRUE(C.is_zero(c));
90 }
91 C.clear(c);
92 C.clear(b);
93 C.clear(a);
94}
const int ntrials
Definition ARingTest.hpp:42
void negate(ElementType &result, const ElementType &a) const
Definition aring-CC.hpp:228
elem ElementType
Definition aring-CC.hpp:81
void add(ElementType &res, const ElementType &a, const ElementType &b) const
Definition aring-CC.hpp:255
bool is_zero(const ElementType &f) const
Definition aring-CC.hpp:103
void init(ElementType &result) const
Definition aring-CC.hpp:150
static void clear(ElementType &result)
Definition aring-CC.hpp:164

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

Referenced by TEST().