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
TEST_SUITE2(LibraryInterface,AlexanderDual)25 TEST_SUITE2(LibraryInterface, AlexanderDual)
26
27 TEST(AlexanderDual, ImplicitPoint) {
28 Frobby::Ideal ideal = toLibIdeal(IdealFactory::xx_yy_xz_yz());
29 LibIdealConsumer consumer(IdealFactory::ring_xyzt());
30
31 Frobby::alexanderDual(ideal, 0, consumer);
32
33 ASSERT_EQ(consumer.getIdeal(), IdealFactory::xyz_xxyy());
34 }
35
TEST(AlexanderDual,ExplicitPoint)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;
42 Frobby::Ideal ideal = toLibIdeal(IdealFactory::xx_yy_xz_yz());
43 LibIdealConsumer consumer(IdealFactory::ring_xyzt());
44
45 Frobby::alexanderDual(ideal, castLibArray(pointLcm), consumer);
46
47 ASSERT_EQ(consumer.getIdeal(), IdealFactory::xyzzz_xxyy());
48 }
49
TEST(AlexanderDual,ZeroIdeal)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
TEST(AlexanderDual,WholeRing)61 TEST(AlexanderDual, WholeRing) {
62 for (size_t varCount = 0; varCount <= 3; ++varCount) {
63 Frobby::Ideal ideal = toLibIdeal(IdealFactory::wholeRing(varCount));
64 LibIdealConsumer consumer((VarNames(varCount)));
65
66 Frobby::alexanderDual(ideal, 0, consumer);
67
68 ASSERT_EQ(consumer.getIdeal(), IdealFactory::zeroIdeal(varCount));
69 }
70 }
71