Public Member Functions
CoeffsTestSuite Class Reference

#include <coeffs_test.h>

Public Member Functions

void test_Z2m4 ()
 
void test_Zp101 ()
 
void test_Z2m8 ()
 
void simple (const n_coeffType _type)
 
void test_Q ()
 
void test_R ()
 
void test_Z ()
 
void test_GF_toobig ()
 
void test_GF ()
 
void test_Zn3 ()
 
void test_Z2m2 ()
 
void test_LR ()
 
void test_LC ()
 
void test_Q_special ()
 
- Public Member Functions inherited from CxxTest::TestSuite
virtual ~TestSuite ()
 
virtual void setUp ()
 
virtual void tearDown ()
 

Detailed Description

Definition at line 359 of file coeffs_test.h.

Member Function Documentation

void CoeffsTestSuite::simple ( const n_coeffType  _type)
inline

Definition at line 386 of file coeffs_test.h.

387  {
388  n_coeffType type = _type;
389  TS_ASSERT( type == _type ); // ?
390  TS_ASSERT( Test(type) );
391  }
#define TS_ASSERT(e)
Definition: TestSuite.h:239
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:215
n_coeffType
Definition: coeffs.h:27
void CoeffsTestSuite::test_GF ( )
inline

Definition at line 428 of file coeffs_test.h.

429  {
430  // TODO: what if it was already registered?
431  // Q: no way to deRegister a type?
432  n_coeffType type = n_GF;
433 
434  GFInfo param;
435 
436  param.GFChar= 5;
437  param.GFDegree= 2;
438  param.GFPar_name= (const char*)"Q";
439 
440  TS_ASSERT( Test(type, (void*) &param) );
441 
442  // it should not be used by numbers... right?
443  // TODO: what is our policy wrt param-pointer-ownership?
444  }
const char * GFPar_name
Definition: coeffs.h:95
#define TS_ASSERT(e)
Definition: TestSuite.h:239
Creation data needed for finite fields.
Definition: coeffs.h:91
int GFDegree
Definition: coeffs.h:94
int GFChar
Definition: coeffs.h:93
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:215
n_coeffType
Definition: coeffs.h:27
{p^n < 2^16}
Definition: coeffs.h:33
void CoeffsTestSuite::test_GF_toobig ( )
inline

Definition at line 412 of file coeffs_test.h.

413  {
414  n_coeffType type = n_GF;
415 
416  GFInfo param;
417 
418  param.GFChar= 5;
419  param.GFDegree= 12;
420  param.GFPar_name= (const char*)"q";
421 
422  TS_ASSERT( !Test(type, (void*) &param) );
423 
424  // it should not be used by numbers... right?
425  // TODO: what is our policy wrt param-pointer-ownership?
426  }
const char * GFPar_name
Definition: coeffs.h:95
#define TS_ASSERT(e)
Definition: TestSuite.h:239
Creation data needed for finite fields.
Definition: coeffs.h:91
int GFDegree
Definition: coeffs.h:94
int GFChar
Definition: coeffs.h:93
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:215
n_coeffType
Definition: coeffs.h:27
{p^n < 2^16}
Definition: coeffs.h:33
void CoeffsTestSuite::test_LC ( )
inline

Definition at line 475 of file coeffs_test.h.

476  {
477  simple(n_long_C);
478  }
complex floating point (GMP) numbers
Definition: coeffs.h:41
void simple(const n_coeffType _type)
Definition: coeffs_test.h:386
void CoeffsTestSuite::test_LR ( )
inline

Definition at line 470 of file coeffs_test.h.

471  {
472  simple(n_long_R);
473  }
real floating point (GMP) numbers
Definition: coeffs.h:34
void simple(const n_coeffType _type)
Definition: coeffs_test.h:386
void CoeffsTestSuite::test_Q ( )
inline

Definition at line 393 of file coeffs_test.h.

394  {
395  simple(n_Q);
396  }
rational (GMP) numbers
Definition: coeffs.h:31
void simple(const n_coeffType _type)
Definition: coeffs_test.h:386
void CoeffsTestSuite::test_Q_special ( )
inline

Definition at line 480 of file coeffs_test.h.

481  {
482  const coeffs cf = nInitChar(n_Q, NULLp);
483 
484  if (cf == NULLp)
485  clog << ( "Test: could not get this coeff. domain" );
486 
487  TS_ASSERT_DIFFERS(cf->cfCoeffWrite, NULLp);
488 
489  if (cf->cfCoeffWrite != NULL )
490  {
491  clog << "Coeff-domain: " << endl;
492  n_CoeffWrite(cf); PrintLn();
493  }
494 
495  number q1 = n_Init(21, cf);
496  number q2 = n_Init(2, cf);
497  number q3 = n_Div(q1, q2, cf);
498  number q4 = n_Init(30, cf);
499  number q5 = n_Mult(q3, q4, cf);
500  TS_ASSERT(n_Test(q5, cf));
501  Print("21/2 * 30 = %ld\n", n_Int(q5, cf));
502  TS_ASSERT(n_Test(q5, cf));
503  n_Delete(&q1, cf);
504  n_Delete(&q2, cf);
505  n_Delete(&q3, cf);
506  n_Delete(&q4, cf);
507  n_Delete(&q5, cf);
508  }
#define NULLp
Definition: auxiliary.h:152
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
rational (GMP) numbers
Definition: coeffs.h:31
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:539
#define TS_ASSERT(e)
Definition: TestSuite.h:239
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:635
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ...
Definition: coeffs.h:548
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:923
CanonicalForm cf
Definition: cfModGcd.cc:4024
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
Definition: coeffs.h:737
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
#define TS_ASSERT_DIFFERS(x, y)
Definition: TestSuite.h:287
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:327
void CoeffsTestSuite::test_R ( )
inline

Definition at line 398 of file coeffs_test.h.

399  {
400  simple(n_R);
401  }
single prescision (6,6) real numbers
Definition: coeffs.h:32
void simple(const n_coeffType _type)
Definition: coeffs_test.h:386
void CoeffsTestSuite::test_Z ( )
inline

Definition at line 404 of file coeffs_test.h.

405  {
406 #ifdef HAVE_RINGS
407  simple(n_Z); // No need in GMP?
408 #endif
409  }
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:42
void simple(const n_coeffType _type)
Definition: coeffs_test.h:386
void CoeffsTestSuite::test_Z2m2 ( )
inline

Definition at line 461 of file coeffs_test.h.

462  {
463 #ifdef HAVE_RINGS
464  n_coeffType type = n_Z2m;
465 
466  TS_ASSERT( Test(type, (void*) 2) );
467 #endif
468  }
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:45
#define TS_ASSERT(e)
Definition: TestSuite.h:239
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:215
n_coeffType
Definition: coeffs.h:27
void CoeffsTestSuite::test_Z2m4 ( )
inline

Definition at line 364 of file coeffs_test.h.

365  {
366 #ifdef HAVE_RINGS
367  n_coeffType type = n_Z2m;
368  TS_ASSERT( Test(type, (void*) 4) );
369 #endif
370  }
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:45
#define TS_ASSERT(e)
Definition: TestSuite.h:239
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:215
n_coeffType
Definition: coeffs.h:27
void CoeffsTestSuite::test_Z2m8 ( )
inline

Definition at line 378 of file coeffs_test.h.

379  {
380 #ifdef HAVE_RINGS
381  n_coeffType type = n_Z2m;
382  TS_ASSERT( Test(type, (void*) 8) );
383 #endif
384  }
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:45
#define TS_ASSERT(e)
Definition: TestSuite.h:239
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:215
n_coeffType
Definition: coeffs.h:27
void CoeffsTestSuite::test_Zn3 ( )
inline

Definition at line 447 of file coeffs_test.h.

448  {
449 #ifdef HAVE_RINGS
450  n_coeffType type = n_Zn;
451 
452  ZnmInfo Znmparam;
453  Znmparam.base= (mpz_ptr) omAlloc (sizeof (mpz_t));
454  mpz_init_set_ui (Znmparam.base, 3);
455  Znmparam.exp= 1;
456 
457  TS_ASSERT( Test(type, (void*) &Znmparam) );
458 #endif
459  }
mpz_ptr base
Definition: rmodulon.h:18
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:43
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define TS_ASSERT(e)
Definition: TestSuite.h:239
unsigned long exp
Definition: rmodulon.h:18
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:215
n_coeffType
Definition: coeffs.h:27
void CoeffsTestSuite::test_Zp101 ( )
inline

Definition at line 372 of file coeffs_test.h.

373  {
374  n_coeffType type = n_Zp;
375  TS_ASSERT( Test(type, (void*) 101) );
376  }
{p < 2^31}
Definition: coeffs.h:30
#define TS_ASSERT(e)
Definition: TestSuite.h:239
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:215
n_coeffType
Definition: coeffs.h:27

The documentation for this class was generated from the following file: