LibAssociatedPrimesTest.cpp
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2010 University of Aarhus
Contact Bjarke Hammersholt Roune for license information (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#include "stdinc.h"
#include "frobby.h"
#include "tests.h"
#include "IdealFactory.h"
#include "LibTest.h"
#include "BigIdeal.h"
#include <vector>
TEST_SUITE2(LibraryInterface, AssociatedPrimes)
TEST(AssociatedPrimes, Typical) {
Frobby::Ideal ideal = toLibIdeal(IdealFactory::xx_yy_xz_yz());
LibIdealsConsumer consumer(IdealFactory::ring_xyzt());
Frobby::associatedPrimes(ideal, consumer);
ASSERT_EQ(consumer.getIdeals(), IdealFactory::assoprimes_xx_yy_xz_yz());
}
TEST(AssociatedPrimes, ZeroIdeal) {
for (size_t varCount = 0; varCount <= 3; ++varCount) {
Frobby::Ideal frobbyInputIdeal(varCount);
LibIdealsConsumer consumer((VarNames(varCount)));
Frobby::associatedPrimes(frobbyInputIdeal, consumer);
vector<BigIdeal> ideals;
ideals.push_back(IdealFactory::zeroIdeal(varCount));
ASSERT_EQ(consumer.getIdeals(), ideals);
}
}
TEST(AssociatedPrimes, WholeRing) {
for (size_t varCount = 0; varCount <= 3; ++varCount) {
Frobby::Ideal ideal = toLibIdeal(IdealFactory::wholeRing(varCount));
LibIdealsConsumer consumer((VarNames(varCount)));
Frobby::associatedPrimes(ideal, consumer);
ASSERT_EQ(consumer.getIdeals(), vector<BigIdeal>());
}
}
BigIdeal.h
IdealFactory.h
toLibIdeal
Frobby::Ideal toLibIdeal(const BigIdeal &ideal)
Returns a library interface ideal that corresponds to the parameter ideal.
Definition LibTest.cpp:26
LibTest.h
ASSERT_EQ
#define ASSERT_EQ(A, B)
Definition asserts.h:152
Frobby::Ideal
Definition frobby.h:35
IdealFactory::xx_yy_xz_yz
static BigIdeal xx_yy_xz_yz()
Returns .
Definition IdealFactory.cpp:31
IdealFactory::ring_xyzt
static VarNames ring_xyzt()
Returns the ring in the four variables , , and .
Definition IdealFactory.cpp:22
IdealFactory::assoprimes_xx_yy_xz_yz
static vector< BigIdeal > assoprimes_xx_yy_xz_yz()
Returns the associated primes of .
Definition IdealFactory.cpp:141
IdealFactory::zeroIdeal
static BigIdeal zeroIdeal(size_t varCount)
Returns the ideal in the ring VarNames(varCount).
Definition IdealFactory.cpp:155
IdealFactory::wholeRing
static BigIdeal wholeRing(size_t varCount)
Returns in the ring VarNames(varCount).
Definition IdealFactory.cpp:149
LibIdealsConsumer
Records library interface output into a vector of BigIdeals.
Definition LibTest.h:58
LibIdealsConsumer::getIdeals
const vector< BigIdeal > & getIdeals() const
Returns the recorded ideals in a canonical form.
Definition LibTest.cpp:91
VarNames
Defines the variables of a polynomial ring and facilities IO involving them.
Definition VarNames.h:40
frobby.h
TEST_SUITE2
#define TEST_SUITE2(PARENT, SUITE)
Definition macroes.h:28
TEST
#define TEST(SUITE, TEST_NAME)
Definition macroes.h:41
Frobby::associatedPrimes
void associatedPrimes(const Ideal &ideal, IdealConsumer &consumer)
Compute the associated primes of the ideal.
Definition frobby.cpp:459
stdinc.h
This header file includes common definitions and is included as the first line of code in every imple...
tests.h