Frobby  0.9.5
LibAlexanderDualTest.cpp
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #include "stdinc.h"
18 #include "frobby.h"
19 
20 #include "tests.h"
21 #include "BigIdeal.h"
22 #include "IdealFactory.h"
23 #include "LibTest.h"
24 
25 TEST_SUITE2(LibraryInterface, AlexanderDual)
26 
27 TEST(AlexanderDual, ImplicitPoint) {
30 
31  Frobby::alexanderDual(ideal, 0, consumer);
32 
34 }
35 
36 TEST(AlexanderDual, ExplicitPoint) {
37  vector<mpz_class> pointLcm(4);
38  pointLcm[0] = 2;
39  pointLcm[1] = 2;
40  pointLcm[2] = 3;
41  pointLcm[3] = 100;
44 
45  Frobby::alexanderDual(ideal, castLibArray(pointLcm), consumer);
46 
48 }
49 
50 TEST(AlexanderDual, ZeroIdeal) {
51  for (size_t varCount = 0; varCount <= 3; ++varCount) {
52  Frobby::Ideal ideal(varCount);
53  LibIdealConsumer consumer((VarNames(varCount)));
54 
55  Frobby::alexanderDual(ideal, 0, consumer);
56 
57  ASSERT_EQ(consumer.getIdeal(), IdealFactory::wholeRing(varCount));
58  }
59 }
60 
61 TEST(AlexanderDual, WholeRing) {
62  for (size_t varCount = 0; varCount <= 3; ++varCount) {
64  LibIdealConsumer consumer((VarNames(varCount)));
65 
66  Frobby::alexanderDual(ideal, 0, consumer);
67 
68  ASSERT_EQ(consumer.getIdeal(), IdealFactory::zeroIdeal(varCount));
69  }
70 }
TEST(AlexanderDual, ImplicitPoint)
const mpz_t * castLibArray(const vector< mpz_class > &vect)
Returns a pointer to an array of mpt_t that represents the entries in the mpz_class.
Definition: LibTest.cpp:41
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 xyz_xxyy()
Returns .
static BigIdeal xyzzz_xxyy()
Returns .
static BigIdeal xx_yy_xz_yz()
Returns .
static VarNames ring_xyzt()
Returns the ring in the four variables , , and .
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 BigIdeal.
Definition: LibTest.h:39
const BigIdeal & getIdeal() const
Returns the recorded ideal in a canonical form.
Definition: LibTest.cpp:66
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
bool alexanderDual(const Ideal &ideal, const mpz_t *reflectionMonomial, IdealConsumer &consumer)
Compute the Alexander dual of ideal using the point reflectionMonomial.
Definition: frobby.cpp:246