LibDimensionTest.cpp
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2009 Bjarke Hammersholt Roune (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 "BigIdeal.h"
#include "IdealFactory.h"
#include "LibTest.h"
TEST_SUITE2(LibraryInterface, DimensionAndCodimension)
namespace {
mpz_class dimension(const BigIdeal& ideal) {
mpz_class dim;
Frobby::dimension(toLibIdeal(ideal), dim.get_mpz_t());
return dim;
}
mpz_class codimension(const BigIdeal& ideal) {
mpz_class codim;
Frobby::codimension(toLibIdeal(ideal), codim.get_mpz_t());
return codim;
}
}
TEST(DimensionAndCodimension, WholeRing) {
ASSERT_EQ(dimension(IdealFactory::wholeRing(0)), -1);
ASSERT_EQ(codimension(IdealFactory::wholeRing(0)), 1);
ASSERT_EQ(dimension(IdealFactory::wholeRing(5)), -1);
ASSERT_EQ(codimension(IdealFactory::wholeRing(5)), 6);
}
TEST(DimensionAndCodimension, ZeroIdeal) {
ASSERT_EQ(dimension(IdealFactory::zeroIdeal(0)), 0);
ASSERT_EQ(codimension(IdealFactory::zeroIdeal(0)), 0);
ASSERT_EQ(dimension(IdealFactory::zeroIdeal(5)), 5);
ASSERT_EQ(codimension(IdealFactory::zeroIdeal(5)), 0);
}
TEST(DimensionAndCodimension, Typical) {
ASSERT_EQ(dimension(IdealFactory::xy_xz()), 3);
ASSERT_EQ(codimension(IdealFactory::xy_xz()), 1);
ASSERT_EQ(dimension(IdealFactory::xx_yy_xz_yz()), 2);
ASSERT_EQ(codimension(IdealFactory::xx_yy_xz_yz()), 2);
}
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
BigIdeal
Definition BigIdeal.h:27
IdealFactory::xy_xz
static BigIdeal xy_xz()
Returns .
Definition IdealFactory.cpp:111
IdealFactory::xx_yy_xz_yz
static BigIdeal xx_yy_xz_yz()
Returns .
Definition IdealFactory.cpp:31
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
frobby.h
TEST_SUITE2
#define TEST_SUITE2(PARENT, SUITE)
Definition macroes.h:28
TEST
#define TEST(SUITE, TEST_NAME)
Definition macroes.h:41
Frobby::dimension
void dimension(const Ideal &ideal, mpz_t dim)
Compute the Krull dimension of a monomial ideal.
Definition frobby.cpp:451
Frobby::codimension
void codimension(const Ideal &ideal, mpz_t codim)
Compute the codimension of a monomial ideal.
Definition frobby.cpp:445
stdinc.h
This header file includes common definitions and is included as the first line of code in every imple...
tests.h