My Project
Loading...
Searching...
No Matches
rings_test.h
Go to the documentation of this file.
1#include "common.h"
2using namespace std;
3
4// the following headers are private...
5
6
9
10
11
12
14{
15 public:
16 virtual bool setUpWorld()
17 {
18
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//
42
43
44namespace
45{
46 void PrintRing(const ring r)
47 {
48 rWrite(r); PrintLn();
49#ifdef RDEBUG
50 rDebugPrint(r); PrintLn();
51#endif
52 }
53static inline void Test(const ring)
54{
55 // does nothing yet...
56}
57
58}
59
61{
62public:
64 {
65 clog << "Creating Z/13[t]: " << endl;
66
67 char* n[] = { (char*)"t"};
68 ring r = rDefault( 13, 1, n);
70
71 PrintRing(r);
72
75
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);
94
95 PrintRing(r);
96
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
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);
117
118 PrintRing(r);
119
121 TS_ASSERT( !rField_is_Q(r) );
122
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
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);
141
142 PrintRing(r);
143
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
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, &param );
171
173
174 ring r = rDefault( cf, 1, n); // now cf belongs to r!
176
177 PrintRing(r);
178
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) );
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
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);
223
224 PrintRing(r);
225
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
#define TS_ASSERT_EQUALS(x, y)
Definition: TestSuite.h:255
#define TS_ASSERT_DIFFERS(x, y)
Definition: TestSuite.h:287
#define TS_ASSERT(e)
Definition: TestSuite.h:239
#define NULLp
Definition: auxiliary.h:108
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
CanonicalForm cf
Definition: cfModGcd.cc:4083
virtual bool setUpWorld()
Definition: common.h:116
virtual bool setUpWorld()
Definition: rings_test.h:16
void test_QQ_x_y_z_ord_2_lp()
Definition: rings_test.h:201
void test_QQ_t()
Definition: rings_test.h:87
void test_Z11_x_y_z()
Definition: rings_test.h:110
void test_Z13_t_GF()
Definition: rings_test.h:158
void test_QQ_x_y_z()
Definition: rings_test.h:134
void test_Z13_t()
Definition: rings_test.h:63
int GFDegree
Definition: coeffs.h:95
@ n_GF
\GF{p^n < 2^16}
Definition: coeffs.h:32
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:413
const char * GFPar_name
Definition: coeffs.h:96
int GFChar
Definition: coeffs.h:94
Creation data needed for finite fields.
Definition: coeffs.h:93
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:209
#define D(A)
Definition: gentable.cc:131
The main handler for Singular numbers which are suitable for Singular polynomials.
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void PrintLn()
Definition: reporter.cc:310
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:226
void rDebugPrint(const ring r)
Definition: ring.cc:4122
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:450
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:102
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:500
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:487
rRingOrder_t
order stuff
Definition: ring.h:68
@ ringorder_dp
Definition: ring.h:78
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:506
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:521
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592
static MyGlobalPrintingFixture globalPrintingFixture
Definition: rings_test.h:41