My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
libpolys
tests
rings_test.h
Go to the documentation of this file.
1
#include "
common.h
"
2
using namespace
std;
3
4
// the following headers are private...
5
6
7
#include "
polys/monomials/ring.h
"
8
#include "
polys/monomials/p_polys.h
"
9
10
11
12
13
class
MyGlobalPrintingFixture
:
public
GlobalPrintingFixture
14
{
15
public
:
16
virtual
bool
setUpWorld
()
17
{
18
19
GlobalPrintingFixture::setUpWorld
();
20
21
22
//TS_ASSERT_EQUALS( nRegister( n_Zp, npInitChar), n_Zp );
23
//TS_ASSERT_EQUALS( nRegister( n_GF, nfInitChar), n_GF );
24
//TS_ASSERT_EQUALS( nRegister( n_R, nrInitChar), n_R );
25
//TS_ASSERT_EQUALS( nRegister( n_Q, nlInitChar), n_Q );
26
//TS_ASSERT_EQUALS( nRegister( n_R, nrInitChar), n_R );
27
28
#ifdef HAVE_RINGS
29
//TS_ASSERT_EQUALS( nRegister( n_Z, nrzInitChar), n_Z ); // these are UNusable at the moment!
30
#endif
31
32
return
true
;
33
}
34
};
35
36
37
//
38
// We can rely on this file being included exactly once
39
// and declare this global variable in the header file.
40
//
41
static
MyGlobalPrintingFixture
globalPrintingFixture
;
42
43
44
namespace
45
{
46
void
PrintRing(
const
ring r)
47
{
48
rWrite
(r);
PrintLn
();
49
#ifdef RDEBUG
50
rDebugPrint
(r);
PrintLn
();
51
#endif
52
}
53
static
inline
void
Test
(
const
ring)
54
{
55
// does nothing yet...
56
}
57
58
}
59
60
class
PolysTestSuite
:
public
CxxTest::TestSuite
61
{
62
public
:
63
void
test_Z13_t
()
64
{
65
clog <<
"Creating Z/13[t]: "
<< endl;
66
67
char
* n[] = { (
char
*)
"t"
};
68
ring r =
rDefault
( 13, 1, n);
69
TS_ASSERT_DIFFERS
( r,
NULLp
);
70
71
PrintRing(r);
72
73
TS_ASSERT
(
rField_is_Domain
(r) );
74
TS_ASSERT
( !
rField_is_Q
(r) );
75
76
TS_ASSERT
(
rField_is_Zp
(r) );
77
TS_ASSERT
( !
rField_is_Zp
(r, 11) );
78
TS_ASSERT
(
rField_is_Zp
(r, 13) );
79
80
TS_ASSERT_EQUALS
(
rVar
(r), 1);
81
82
Test
(r);
83
84
rDelete
(r);
85
}
86
87
void
test_QQ_t
()
88
{
89
clog <<
"Creating Q[s]: "
<< endl;
90
91
char
* n[] = {(
char
*)
"s"
};
92
ring r =
rDefault
( 0, 1, n);
93
TS_ASSERT_DIFFERS
( r,
NULLp
);
94
95
PrintRing(r);
96
97
TS_ASSERT
(
rField_is_Domain
(r) );
98
TS_ASSERT
(
rField_is_Q
(r) );
99
100
TS_ASSERT
( !
rField_is_Zp
(r) );
101
TS_ASSERT
( !
rField_is_Zp
(r, 11) );
102
103
TS_ASSERT_EQUALS
(
rVar
(r), 1);
104
105
Test
(r);
106
107
rDelete
(r);
108
}
109
110
void
test_Z11_x_y_z
()
111
{
112
clog <<
"Creating Z/11[x, y, z]: "
<< endl;
113
114
char
* n[] = {(
char
*)
"x"
, (
char
*)
"y"
, (
char
*)
"z"
};
115
ring r =
rDefault
( 11, 3, n);
116
TS_ASSERT_DIFFERS
( r,
NULLp
);
117
118
PrintRing(r);
119
120
TS_ASSERT
(
rField_is_Domain
(r) );
121
TS_ASSERT
( !
rField_is_Q
(r) );
122
123
TS_ASSERT
(
rField_is_Zp
(r) );
124
TS_ASSERT
(
rField_is_Zp
(r, 11) );
125
TS_ASSERT
( !
rField_is_Zp
(r, 13) );
126
127
TS_ASSERT_EQUALS
(
rVar
(r), 3);
128
129
Test
(r);
130
131
rDelete
(r);
132
}
133
134
void
test_QQ_x_y_z
()
135
{
136
clog <<
"Creating QQ[x, y, z, u]: "
<< endl;
137
138
char
* n[] = {(
char
*)
"x"
, (
char
*)
"y"
, (
char
*)
"z"
, (
char
*)
"u"
};
139
ring r =
rDefault
( 0, 4, n);
140
TS_ASSERT_DIFFERS
( r,
NULLp
);
141
142
PrintRing(r);
143
144
TS_ASSERT
(
rField_is_Domain
(r) );
145
TS_ASSERT
(
rField_is_Q
(r) );
146
147
TS_ASSERT
( !
rField_is_Zp
(r) );
148
TS_ASSERT
( !
rField_is_Zp
(r, 11) );
149
150
TS_ASSERT_EQUALS
(
rVar
(r), 4);
151
152
Test
(r);
153
154
rDelete
(r);
155
}
156
157
158
void
test_Z13_t_GF
()
159
{
160
clog <<
"Creating GF[t]: "
<< endl;
161
162
char
* n[] = {(
char
*)
"t"
};
163
164
GFInfo
param;
165
166
param.
GFChar
= 5;
167
param.
GFDegree
= 2;
168
param.
GFPar_name
= (
const
char
*)
"Q"
;
169
170
const
coeffs
cf
=
nInitChar
(
n_GF
, ¶m );
171
172
TS_ASSERT_DIFFERS
(
cf
,
NULLp
);
173
174
ring r =
rDefault
(
cf
, 1, n);
// now cf belongs to r!
175
TS_ASSERT_DIFFERS
( r,
NULLp
);
176
177
PrintRing(r);
178
179
TS_ASSERT
(
rField_is_Domain
(r) );
180
TS_ASSERT
( !
rField_is_Q
(r) );
181
182
TS_ASSERT
( !
rField_is_Zp
(r) );
183
TS_ASSERT
( !
rField_is_Zp
(r, 11) );
184
TS_ASSERT
( !
rField_is_Zp
(r, 13) );
185
TS_ASSERT
(
rField_is_GF
(r) );
186
187
TS_ASSERT
(
rField_is_GF
(r, 5) );
188
TS_ASSERT
( !
rField_is_GF
(r, 25) );
189
190
TS_ASSERT_EQUALS
(
rVar
(r), 1);
191
192
Test
(r);
193
194
rDelete
(r);
// kills 'cf' as well!
195
}
196
197
198
199
200
201
void
test_QQ_x_y_z_ord_2_lp
()
202
{
203
clog <<
"Creating QQ[x, y, z, u]: "
<< endl;
204
205
const
int
N
= 4;
206
char
* n[
N
] = {(
char
*)
"x"
, (
char
*)
"y"
, (
char
*)
"z"
, (
char
*)
"u"
};
207
208
209
const
int
D
= 2;
210
/*order: lp,0*/
211
rRingOrder_t
*order = (
rRingOrder_t
*)
omAlloc0
(
D
*
sizeof
(
rRingOrder_t
));
212
int
*block0 = (
int
*)
omAlloc0
(
D
*
sizeof
(
int
));
213
int
*block1 = (
int
*)
omAlloc0
(
D
*
sizeof
(
int
));
214
/* ringorder dp for the first block: var 1..N */
215
order[0] =
ringorder_dp
;
216
block0[0] = 1;
217
block1[0] =
N
;
218
/* the last block: everything is 0 */
219
// order[1] = 0;
220
221
ring r =
rDefault
(0,
N
, n,
D
, order, block0, block1);
222
TS_ASSERT_DIFFERS
( r,
NULLp
);
223
224
PrintRing(r);
225
226
TS_ASSERT
(
rField_is_Domain
(r) );
227
TS_ASSERT
(
rField_is_Q
(r) );
228
229
TS_ASSERT
( !
rField_is_Zp
(r) );
230
TS_ASSERT
( !
rField_is_Zp
(r, 11) );
231
232
TS_ASSERT_EQUALS
(
rVar
(r),
N
);
233
234
Test
(r);
235
236
rDelete
(r);
237
}
238
};
239
TS_ASSERT_EQUALS
#define TS_ASSERT_EQUALS(x, y)
Definition
TestSuite.h:255
TS_ASSERT_DIFFERS
#define TS_ASSERT_DIFFERS(x, y)
Definition
TestSuite.h:287
TS_ASSERT
#define TS_ASSERT(e)
Definition
TestSuite.h:239
NULLp
#define NULLp
Definition
auxiliary.h:109
N
const CanonicalForm CFMap CFMap & N
Definition
cfEzgcd.cc:56
cf
CanonicalForm cf
Definition
cfModGcd.cc:4091
CxxTest::TestSuite
Definition
TestSuite.h:22
GlobalPrintingFixture
Definition
common.h:91
GlobalPrintingFixture::setUpWorld
virtual bool setUpWorld()
Definition
common.h:116
MyGlobalPrintingFixture
Definition
polys_test.h:25
MyGlobalPrintingFixture::setUpWorld
virtual bool setUpWorld()
Definition
rings_test.h:16
PolysTestSuite
Definition
polys_test.h:210
PolysTestSuite::test_QQ_x_y_z_ord_2_lp
void test_QQ_x_y_z_ord_2_lp()
Definition
rings_test.h:201
PolysTestSuite::test_QQ_t
void test_QQ_t()
Definition
rings_test.h:87
PolysTestSuite::test_Z11_x_y_z
void test_Z11_x_y_z()
Definition
rings_test.h:110
PolysTestSuite::test_Z13_t_GF
void test_Z13_t_GF()
Definition
rings_test.h:158
PolysTestSuite::test_QQ_x_y_z
void test_QQ_x_y_z()
Definition
rings_test.h:134
PolysTestSuite::test_Z13_t
void test_Z13_t()
Definition
rings_test.h:63
GFInfo::GFDegree
int GFDegree
Definition
coeffs.h:102
n_GF
@ n_GF
\GF{p^n < 2^16}
Definition
coeffs.h:32
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition
numbers.cc:412
GFInfo::GFPar_name
const char * GFPar_name
Definition
coeffs.h:103
GFInfo::GFChar
int GFChar
Definition
coeffs.h:101
GFInfo
Creation data needed for finite fields.
Definition
coeffs.h:100
globalPrintingFixture
static GlobalPrintingFixture globalPrintingFixture
Definition
coeffs_test.h:350
Test
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition
coeffs_test.h:209
common.h
D
#define D(A)
Definition
gentable.cc:128
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
omAlloc0
#define omAlloc0(size)
Definition
omAllocDecl.h:211
p_polys.h
PrintLn
void PrintLn()
Definition
reporter.cc:314
rWrite
void rWrite(ring r, BOOLEAN details)
Definition
ring.cc:227
rDebugPrint
void rDebugPrint(const ring r)
Definition
ring.cc:4214
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition
ring.cc:454
rDefault
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition
ring.cc:103
ring.h
rField_is_Zp
static BOOLEAN rField_is_Zp(const ring r)
Definition
ring.h:506
rField_is_Domain
static BOOLEAN rField_is_Domain(const ring r)
Definition
ring.h:493
rRingOrder_t
rRingOrder_t
order stuff
Definition
ring.h:69
ringorder_dp
@ ringorder_dp
Definition
ring.h:79
rField_is_Q
static BOOLEAN rField_is_Q(const ring r)
Definition
ring.h:517
rField_is_GF
static BOOLEAN rField_is_GF(const ring r)
Definition
ring.h:532
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition
ring.h:603
Generated on
for My Project by
doxygen 1.17.0
for
Singular