My Project  debian-1:4.1.1-p2+ds-4build1
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 356 of file coeffs_test.h.

Member Function Documentation

◆ simple()

void CoeffsTestSuite::simple ( const n_coeffType  _type)
inline

Definition at line 383 of file coeffs_test.h.

384  {
385  n_coeffType type = _type;
386  TS_ASSERT( type == _type ); // ?
387  TS_ASSERT( Test(type) );
388  }

◆ test_GF()

void CoeffsTestSuite::test_GF ( )
inline

Definition at line 425 of file coeffs_test.h.

426  {
427  // TODO: what if it was already registered?
428  // Q: no way to deRegister a type?
429  n_coeffType type = n_GF;
430 
431  GFInfo param;
432 
433  param.GFChar= 5;
434  param.GFDegree= 2;
435  param.GFPar_name= (const char*)"Q";
436 
437  TS_ASSERT( Test(type, (void*) &param) );
438 
439  // it should not be used by numbers... right?
440  // TODO: what is our policy wrt param-pointer-ownership?
441  }

◆ test_GF_toobig()

void CoeffsTestSuite::test_GF_toobig ( )
inline

Definition at line 409 of file coeffs_test.h.

410  {
411  n_coeffType type = n_GF;
412 
413  GFInfo param;
414 
415  param.GFChar= 5;
416  param.GFDegree= 12;
417  param.GFPar_name= (const char*)"q";
418 
419  TS_ASSERT( !Test(type, (void*) &param) );
420 
421  // it should not be used by numbers... right?
422  // TODO: what is our policy wrt param-pointer-ownership?
423  }

◆ test_LC()

void CoeffsTestSuite::test_LC ( )
inline

Definition at line 472 of file coeffs_test.h.

473  {
474  simple(n_long_C);
475  }

◆ test_LR()

void CoeffsTestSuite::test_LR ( )
inline

Definition at line 467 of file coeffs_test.h.

468  {
469  simple(n_long_R);
470  }

◆ test_Q()

void CoeffsTestSuite::test_Q ( )
inline

Definition at line 390 of file coeffs_test.h.

391  {
392  simple(n_Q);
393  }

◆ test_Q_special()

void CoeffsTestSuite::test_Q_special ( )
inline

Definition at line 477 of file coeffs_test.h.

478  {
479  const coeffs cf = nInitChar(n_Q, NULLp);
480 
481  if (cf == NULLp)
482  clog << ( "Test: could not get this coeff. domain" );
483 
484  TS_ASSERT_DIFFERS(cf->cfCoeffWrite, NULLp);
485 
486  if (cf->cfCoeffWrite != NULL )
487  {
488  clog << "Coeff-domain: " << endl;
489  n_CoeffWrite(cf); PrintLn();
490  }
491 
492  number q1 = n_Init(21, cf);
493  number q2 = n_Init(2, cf);
494  number q3 = n_Div(q1, q2, cf);
495  number q4 = n_Init(30, cf);
496  number q5 = n_Mult(q3, q4, cf);
497  TS_ASSERT(n_Test(q5, cf));
498  Print("21/2 * 30 = %ld\n", n_Int(q5, cf));
499  TS_ASSERT(n_Test(q5, cf));
500  n_Delete(&q1, cf);
501  n_Delete(&q2, cf);
502  n_Delete(&q3, cf);
503  n_Delete(&q4, cf);
504  n_Delete(&q5, cf);
505  }

◆ test_R()

void CoeffsTestSuite::test_R ( )
inline

Definition at line 395 of file coeffs_test.h.

396  {
397  simple(n_R);
398  }

◆ test_Z()

void CoeffsTestSuite::test_Z ( )
inline

Definition at line 401 of file coeffs_test.h.

402  {
403 #ifdef HAVE_RINGS
404  simple(n_Z); // No need in GMP?
405 #endif
406  }

◆ test_Z2m2()

void CoeffsTestSuite::test_Z2m2 ( )
inline

Definition at line 458 of file coeffs_test.h.

459  {
460 #ifdef HAVE_RINGS
461  n_coeffType type = n_Z2m;
462 
463  TS_ASSERT( Test(type, (void*) 2) );
464 #endif
465  }

◆ test_Z2m4()

void CoeffsTestSuite::test_Z2m4 ( )
inline

Definition at line 361 of file coeffs_test.h.

362  {
363 #ifdef HAVE_RINGS
364  n_coeffType type = n_Z2m;
365  TS_ASSERT( Test(type, (void*) 4) );
366 #endif
367  }

◆ test_Z2m8()

void CoeffsTestSuite::test_Z2m8 ( )
inline

Definition at line 375 of file coeffs_test.h.

376  {
377 #ifdef HAVE_RINGS
378  n_coeffType type = n_Z2m;
379  TS_ASSERT( Test(type, (void*) 8) );
380 #endif
381  }

◆ test_Zn3()

void CoeffsTestSuite::test_Zn3 ( )
inline

Definition at line 444 of file coeffs_test.h.

445  {
446 #ifdef HAVE_RINGS
447  n_coeffType type = n_Zn;
448 
449  ZnmInfo Znmparam;
450  Znmparam.base= (mpz_ptr) omAlloc (sizeof (mpz_t));
451  mpz_init_set_ui (Znmparam.base, 3);
452  Znmparam.exp= 1;
453 
454  TS_ASSERT( Test(type, (void*) &Znmparam) );
455 #endif
456  }

◆ test_Zp101()

void CoeffsTestSuite::test_Zp101 ( )
inline

Definition at line 369 of file coeffs_test.h.

370  {
371  n_coeffType type = n_Zp;
372  TS_ASSERT( Test(type, (void*) 101) );
373  }

The documentation for this class was generated from the following file:
n_Zn
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
TS_ASSERT_DIFFERS
#define TS_ASSERT_DIFFERS(x, y)
Definition: TestSuite.h:287
GFInfo::GFChar
int GFChar
Definition: coeffs.h:94
TS_ASSERT
#define TS_ASSERT(e)
Definition: TestSuite.h:239
Test
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:212
GFInfo
Creation data needed for finite fields.
Definition: coeffs.h:92
n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:41
ZnmInfo::exp
unsigned long exp
Definition: rmodulon.h:17
n_Z2m
only used if HAVE_RINGS is defined
Definition: coeffs.h:46
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
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:349
n_Q
rational (GMP) numbers
Definition: coeffs.h:30
n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:33
n_coeffType
n_coeffType
Definition: coeffs.h:26
n_CoeffWrite
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
Definition: coeffs.h:741
ZnmInfo::base
mpz_ptr base
Definition: rmodulon.h:17
GFInfo::GFDegree
int GFDegree
Definition: coeffs.h:95
coeffs
n_Z
only used if HAVE_RINGS is defined
Definition: coeffs.h:43
n_Mult
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:636
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
n_Init
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:538
GFInfo::GFPar_name
const char * GFPar_name
Definition: coeffs.h:96
n_R
single prescision (6,6) real numbers
Definition: coeffs.h:31
n_Zp
\F{p < 2^31}
Definition: coeffs.h:29
Print
#define Print
Definition: emacs.cc:79
NULLp
#define NULLp
Definition: auxiliary.h:106
NULL
#define NULL
Definition: omList.c:9
n_Int
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:547
CoeffsTestSuite::simple
void simple(const n_coeffType _type)
Definition: coeffs_test.h:383
ZnmInfo
Definition: rmodulon.h:17
n_Div
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
PrintLn
void PrintLn()
Definition: reporter.cc:309
n_Test
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738