Macaulay2 Engine
Loading...
Searching...
No Matches
RingTest.hpp File Reference

Shared gtest fixture for the legacy Ring-based Ring*Test.cpp suite. More...

#include <cstdio>
#include <string>
#include <iostream>
#include <memory>
#include <gtest/gtest.h>
#include "interface/random.h"
#include "ZZ.hpp"
#include "exceptions.hpp"

Go to the source code of this file.

Classes

class  RingElementGenerator< RingType >

Functions

template<typename T>
std::istream & fromStream (std::istream &i, const T &R, typename T::ElementType &result)
template<typename T>
bool fromStream (std::istream &i, const T &R, ring_elem &result)
template<typename T>
std::string ringName (const T &R)
template<typename RingType>
ring_elem getElement (const RingType &R, int index)
template<typename T>
void testRingCoercions (const T *R, int ntrials)
template<typename T>
void testRingNegate (const T *R, int ntrials)
template<typename T>
void testRingAdd (const T *R, int ntrials)
template<typename T>
void testRingSubtract (const T *R, int ntrials)
template<typename T>
void testRingDivide (const T *R, int ntrials)
template<typename T>
void testRingAxioms (const T *R, int ntrials)
template<typename T>
void testRingPower (const T *R, int ntrials)
template<typename T>
void testRingGCD (const T *R, int ntrials)
template<typename T>
void testRingRemainder (const T *R, int ntrials)
template<typename T>
void testRingSyzygy (const T *R, int ntrials)

Variables

const int ntrials = 100

Detailed Description

Shared gtest fixture for the legacy Ring-based Ring*Test.cpp suite.

Note
AI-generated documentation. Verify against the source before relying on it.

Declares the harness the legacy-ring tests share: the primary getElement<RingType>(R, index) function template (specialised per ring in the corresponding Ring*Test.cpp) that returns a ring_elem rather than a typed ElementType, the RingElementGenerator<RingType> wrapper handing out one ring_elem per nextElement call, the fromStream parsers for deserialising elements through the engine's istream plumbing, and the ringName(R) helper that drives a buffer through R.text_out so test failure messages name the ring under test. A family of templated drivers — testRingCoercions, testRingNegate, testRingAdd, testRingSubtract, testRingDivide, testRingAxioms, testRingPower, testRingGCD, testRingRemainder, testRingSyzygy — each run ntrials iterations against the generator's output. ntrials = 100 (with a commented // 5000 recording the prior value); the figure is deliberately smaller than the aring suite's 1000 because each legacy call dispatches through virtual Ring methods and is correspondingly slower.

Mirrors ARingTest.hpp for the older ring_elem / tagged-pointer interface that still powers most user-facing polynomial rings and crosses the C boundary to the interpreter.

See also
ARingTest.hpp
interface/random.h
ZZ.hpp
RingZZTest.cpp
RingZZpTest.cpp

Definition in file RingTest.hpp.