Frobby  0.9.5
LibPrimaryDecomTest.cpp
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2009 University of Aarhus
3  Contact Bjarke Hammersholt Roune for license information (www.broune.com)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see http://www.gnu.org/licenses/.
17 */
18 #include "stdinc.h"
19 
20 #include "frobby.h"
21 #include "tests.h"
22 #include "IdealFactory.h"
23 #include "LibTest.h"
24 #include "BigIdeal.h"
25 
26 #include <vector>
27 
28 TEST_SUITE2(LibraryInterface, PrimaryDecom)
29 
30 TEST(PrimaryDecom, Typical) {
33 
34  Frobby::primaryDecomposition(ideal, consumer);
35 
37 }
38 
39 TEST(PrimaryDecom, ZeroIdeal) {
40  for (size_t varCount = 0; varCount <= 3; ++varCount) {
41  Frobby::Ideal frobbyInputIdeal(varCount);
42  LibIdealsConsumer consumer((VarNames(varCount)));
43 
44  Frobby::primaryDecomposition(frobbyInputIdeal, consumer);
45 
46  vector<BigIdeal> ideals;
47  ideals.push_back(IdealFactory::zeroIdeal(varCount));
48  ASSERT_EQ(consumer.getIdeals(), ideals);
49  }
50 }
51 
52 TEST(PrimaryDecom, WholeRing) {
53  for (size_t varCount = 0; varCount <= 3; ++varCount) {
55  LibIdealsConsumer consumer((VarNames(varCount)));
56 
57  Frobby::primaryDecomposition(ideal, consumer);
58 
59  ASSERT_EQ(consumer.getIdeals(), vector<BigIdeal>());
60  }
61 }
TEST(PrimaryDecom, Typical)
Frobby::Ideal toLibIdeal(const BigIdeal &ideal)
Returns a library interface ideal that corresponds to the parameter ideal.
Definition: LibTest.cpp:26
#define ASSERT_EQ(A, B)
Definition: asserts.h:147
static BigIdeal xx_yy_xz_yz()
Returns .
static VarNames ring_xyzt()
Returns the ring in the four variables , , and .
static vector< BigIdeal > irrdecom_xx_yy_xz_yz()
Returns the irreducible decomposition of .
static BigIdeal zeroIdeal(size_t varCount)
Returns the ideal in the ring VarNames(varCount).
static BigIdeal wholeRing(size_t varCount)
Returns in the ring VarNames(varCount).
Records library interface output into a vector of BigIdeals.
Definition: LibTest.h:58
const vector< BigIdeal > & getIdeals() const
Returns the recorded ideals in a canonical form.
Definition: LibTest.cpp:91
Defines the variables of a polynomial ring and facilities IO involving them.
Definition: VarNames.h:40
#define TEST_SUITE2(PARENT, SUITE)
Definition: macroes.h:28
void primaryDecomposition(const Ideal &ideal, IdealConsumer &consumer)
Compute the canonical primary decomposition of a monomial ideal.
Definition: frobby.cpp:396