RawSquareFreeIdealTest.cpp File Reference
`#include "stdinc.h"`
`#include "RawSquareFreeIdeal.h"`
`#include "tests.h"`
`#include "RawSquareFreeTerm.h"`

Go to the source code of this file.

## Macros

#define | TEST_MINIMIZE(idealStr, minimizedStr)
#define | TEST_COLON_REMINIMIZE_TERM(idealStr, colonStr, minimizedStr)
#define | TEST_COLON_REMINIMIZE_VAR(idealStr, colonVar, minimizedStr)
#define | TEST_HASFULLSUPPORT(idealStr, _extraStr, value)
#define | TEST_COMPACT(beforeStr, removeStr, afterStr)
#define | TEST_TRANSPOSE(beforeStr, removeStr, afterStr)

## Functions

| TEST (RawSquareFreeIdeal, Insert_Term)
| TEST (RawSquareFreeIdeal, NewIdealParse)
| TEST (RawSquareFreeIdeal, Equality)
| TEST (RawSquareFreeIdeal, SortLexAscending)
| TEST (RawSquareFreeIdeal, MinimizeAndMinimizable)
| TEST (RawSquareFreeIdeal, ColonReminimizeMinimize_VarAndTerm)
| TEST (RawSquareFreeIdeal, GetVarDividesCounts)
| TEST (RawSquareFreeIdeal, HasFullSupport)
| TEST (RawSquareFreeIdeal, Compact)
| TEST (RawSquareFreeIdeal, Transpose)

## Macro Definition Documentation

## TEST_COLON_REMINIMIZE_TERM

#define TEST_COLON_REMINIMIZE_TERM | ( |  | idealStr,
|  |  | colonStr,
|  |  | minimizedStr )

Value:
{ \
RSFIdeal* ideal = newRawSquareFreeIdealParse(idealStr); \
Word* colon = newTermParse(colonStr); \
RSFIdeal* minimized = newRawSquareFreeIdealParse(minimizedStr); \
ideal->colonReminimize(colon); \
ASSERT_TRUE2(sortedEqual(*ideal, *minimized), *ideal, *minimized); \
ASSERT_TRUE(ideal->isMinimallyGenerated()); \
deleteRawSquareFreeIdeal(ideal); \
deleteTerm(colon); \
deleteRawSquareFreeIdeal(minimized); \
}
RSFIdeal
RawSquareFreeIdeal RSFIdeal
Definition RawSquareFreeIdeal.cpp:30
newRawSquareFreeIdealParse
RawSquareFreeIdeal * newRawSquareFreeIdealParse(const char *str)
Allocates and returns an ideal based on str.
Definition RawSquareFreeIdeal.cpp:819
RawSquareFreeIdeal::colonReminimize
void colonReminimize(const Word *colon)
Performs a colon and minimize.
Definition RawSquareFreeIdeal.cpp:675
RawSquareFreeIdeal::isMinimallyGenerated
bool isMinimallyGenerated() const
Returns true if no generator divides another.
Definition RawSquareFreeIdeal.cpp:579
SquareFreeTermOps::colon
void colon(Word *res, const Word *resEnd, const Word *a, const Word *b)
Definition RawSquareFreeTerm.cpp:176
SquareFreeTermOps::newTermParse
Word * newTermParse(const char *strParam)
Allocates and returns a term based on str.
Definition RawSquareFreeTerm.cpp:25
Word
unsigned long Word
The native unsigned type for the CPU.
Definition stdinc.h:93

Definition at line 184 of file RawSquareFreeIdealTest.cpp.

## TEST_COLON_REMINIMIZE_VAR

#define TEST_COLON_REMINIMIZE_VAR | ( |  | idealStr,
|  |  | colonVar,
|  |  | minimizedStr )

Value:
{ \
RSFIdeal* idealVar = newRawSquareFreeIdealParse(idealStr); \
RSFIdeal* idealTerm = newRawSquareFreeIdealParse(idealStr); \
Word* colon = newTerm(idealTerm->getVarCount()); \
setExponent(colon, colonVar, 1); \
RSFIdeal* minimized = newRawSquareFreeIdealParse(minimizedStr); \
idealVar->colonReminimize((size_t)colonVar); \
ASSERT_TRUE2(sortedEqual(*idealVar, *minimized), *idealVar, *minimized); \
idealTerm->colonReminimize(colon); \
ASSERT_TRUE2(sortedEqual(*idealTerm, *minimized), *idealVar, *minimized); \
deleteRawSquareFreeIdeal(idealVar); \
deleteRawSquareFreeIdeal(idealTerm); \
deleteTerm(colon); \
deleteRawSquareFreeIdeal(minimized); \
}
RawSquareFreeIdeal::getVarCount
size_t getVarCount() const
Definition RawSquareFreeIdeal.h:125
SquareFreeTermOps::newTerm
Word * newTerm(size_t varCount)
Returns identity term of varCount variables.
Definition RawSquareFreeTerm.cpp:139

Definition at line 196 of file RawSquareFreeIdealTest.cpp.

## TEST_COMPACT

#define TEST_COMPACT | ( |  | beforeStr,
|  |  | removeStr,
|  |  | afterStr )

Value:
{ \
RSFIdeal* before = newRawSquareFreeIdealParse(beforeStr); \
Word* remove = newTermParse(removeStr); \
RSFIdeal* after = newRawSquareFreeIdealParse(afterStr); \
before->compact(remove); \
ASSERT_EQ(*before, *after); \
deleteRawSquareFreeIdeal(before); \
deleteTerm(remove); \
deleteRawSquareFreeIdeal(after); \
}
RawSquareFreeIdeal::compact
void compact(const Word *remove)
Removes the variables that divide remove.
Definition RawSquareFreeIdeal.cpp:264

Definition at line 371 of file RawSquareFreeIdealTest.cpp.

## TEST_HASFULLSUPPORT

#define TEST_HASFULLSUPPORT | ( |  | idealStr,
|  |  | _extraStr,
|  |  | value )

Value:
{ \
const char* extraStr = _extraStr; \
Word* extra = extraStr == 0 ? 0 : newTermParse(extraStr); \
RSFIdeal* ideal = newRawSquareFreeIdealParse(idealStr); \
if (value) { \
ASSERT_TRUE2(ideal->hasFullSupport(extra), *ideal, extraStr); \
} else { \
ASSERT_FALSE2(ideal->hasFullSupport(extra), *ideal, extraStr); \
} \
deleteRawSquareFreeIdeal(ideal); \
deleteTerm(extra); \
}
RawSquareFreeIdeal::hasFullSupport
bool hasFullSupport(const Word *ignore) const
Returns true if for every variable it either divides ignore or it divides some (not necessarily minim...
Definition RawSquareFreeIdeal.cpp:545

Definition at line 319 of file RawSquareFreeIdealTest.cpp.

## TEST_MINIMIZE

#define TEST_MINIMIZE | ( |  | idealStr,
|  |  | minimizedStr )

Value:
{ \
RSFIdeal* ideal = newRawSquareFreeIdealParse(idealStr); \
RSFIdeal* minimized = newRawSquareFreeIdealParse(minimizedStr); \
ASSERT_FALSE(ideal->isMinimallyGenerated()); \
ideal->minimize(); \
ASSERT_TRUE(sortedEqual(*ideal, *minimized)); \
ASSERT_TRUE(ideal->isMinimallyGenerated()); \
ideal->minimize(); \
ASSERT_TRUE(sortedEqual(*ideal, *minimized)); \
deleteRawSquareFreeIdeal(ideal); \
deleteRawSquareFreeIdeal(minimized); \
}
RawSquareFreeIdeal::minimize
void minimize()
Definition RawSquareFreeIdeal.cpp:242

Definition at line 146 of file RawSquareFreeIdealTest.cpp.

## TEST_TRANSPOSE

#define TEST_TRANSPOSE | ( |  | beforeStr,
|  |  | removeStr,
|  |  | afterStr )

Value:
{ \
RSFIdeal* before = newRawSquareFreeIdealParse(beforeStr); \
Word* remove = removeStr == 0 ? 0 : newTermParse(removeStr);\
RSFIdeal* after = newRawSquareFreeIdealParse(afterStr); \
const size_t maxDim = before->getGeneratorCount() > before->getVarCount() ?\
before->getGeneratorCount() : before->getVarCount(); \
RSFIdeal* calculated = newRawSquareFreeIdeal(maxDim, maxDim);\
calculated->setToTransposeOf(*before, remove); \
ASSERT_EQ(*calculated, *after); \
calculated->setToTransposeOf(*calculated); \
calculated->transpose(); \
ASSERT_EQ(*calculated, *after); \
deleteRawSquareFreeIdeal(before); \
deleteTerm(remove); \
deleteRawSquareFreeIdeal(after); \
deleteRawSquareFreeIdeal(calculated); \
}
newRawSquareFreeIdeal
RSFIdeal * newRawSquareFreeIdeal(size_t varCount, size_t capacity)
Allocates object with enough memory for capacity generators in varCount variables.
Definition RawSquareFreeIdeal.cpp:797
RawSquareFreeIdeal::getGeneratorCount
size_t getGeneratorCount() const
Definition RawSquareFreeIdeal.h:124
RawSquareFreeIdeal::transpose
void transpose(Word *eraseVars=0)
Equivalent to setToTransposeOf(this, eraseVars).
Definition RawSquareFreeIdeal.cpp:168
RawSquareFreeIdeal::setToTransposeOf
void setToTransposeOf(const RawSquareFreeIdeal &ideal, Word *eraseVars=0)
Resets this object to the transpose of ideal.
Definition RawSquareFreeIdeal.cpp:140

Definition at line 397 of file RawSquareFreeIdealTest.cpp.

## Function Documentation

## TEST() [1/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | ColonReminimizeMinimize_VarAndTerm | )

Definition at line 212 of file RawSquareFreeIdealTest.cpp.

## TEST() [2/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | Compact | )

Definition at line 381 of file RawSquareFreeIdealTest.cpp.

## TEST() [3/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | Equality | )

Definition at line 81 of file RawSquareFreeIdealTest.cpp.

## TEST() [4/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | GetVarDividesCounts | )

Definition at line 285 of file RawSquareFreeIdealTest.cpp.

## TEST() [5/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | HasFullSupport | )

Definition at line 331 of file RawSquareFreeIdealTest.cpp.

## TEST() [6/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | Insert_Term | )

Definition at line 43 of file RawSquareFreeIdealTest.cpp.

## TEST() [7/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | MinimizeAndMinimizable | )

Definition at line 159 of file RawSquareFreeIdealTest.cpp.

## TEST() [8/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | NewIdealParse | )

Definition at line 66 of file RawSquareFreeIdealTest.cpp.

## TEST() [9/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | SortLexAscending | )

Definition at line 120 of file RawSquareFreeIdealTest.cpp.

## TEST() [10/10]

TEST | ( | RawSquareFreeIdeal | ,
|  | Transpose | )

Definition at line 415 of file RawSquareFreeIdealTest.cpp.