Frobby  0.9.5
Macros | Typedefs | Functions
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)
 

Typedefs

typedef RawSquareFreeIdeal RSFIdeal
 

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); \
}
RawSquareFreeIdeal * newRawSquareFreeIdealParse(const char *str)
Allocates and returns an ideal based on str.
void colon(Word *res, const Word *resEnd, const Word *a, const Word *b)
Word * newTermParse(const char *strParam)
Allocates and returns a term based on str.

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); \
}
Word * newTerm(size_t varCount)
Returns identity term of varCount variables.

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); \
}

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); \
}

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); \
}

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); \
}
RSFIdeal * newRawSquareFreeIdeal(size_t varCount, size_t capacity)
Allocates object with enough memory for capacity generators in varCount variables.

Definition at line 397 of file RawSquareFreeIdealTest.cpp.

Typedef Documentation

◆ RSFIdeal

Definition at line 26 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.