My Project
Loading...
Searching...
No Matches
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 353 of file coeffs_test.h.

Member Function Documentation

◆ simple()

void CoeffsTestSuite::simple ( const n_coeffType  _type)
inline

Definition at line 380 of file coeffs_test.h.

381 {
382 n_coeffType type = _type;
383 TS_ASSERT( type == _type ); // ?
384 TS_ASSERT( Test(type) );
385 }
#define TS_ASSERT(e)
Definition: TestSuite.h:239
n_coeffType
Definition: coeffs.h:27
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
Definition: coeffs_test.h:209

◆ test_GF()

void CoeffsTestSuite::test_GF ( )
inline

Definition at line 422 of file coeffs_test.h.

423 {
424 // TODO: what if it was already registered?
425 // Q: no way to deRegister a type?
426 n_coeffType type = n_GF;
427
428 GFInfo param;
429
430 param.GFChar= 5;
431 param.GFDegree= 2;
432 param.GFPar_name= (const char*)"Q";
433
434 TS_ASSERT( Test(type, (void*) &param) );
435
436 // it should not be used by numbers... right?
437 // TODO: what is our policy wrt param-pointer-ownership?
438 }
int GFDegree
Definition: coeffs.h:95
@ n_GF
\GF{p^n < 2^16}
Definition: coeffs.h:32
const char * GFPar_name
Definition: coeffs.h:96
int GFChar
Definition: coeffs.h:94
Creation data needed for finite fields.
Definition: coeffs.h:93

◆ test_GF_toobig()

void CoeffsTestSuite::test_GF_toobig ( )
inline

Definition at line 406 of file coeffs_test.h.

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

◆ test_LC()

void CoeffsTestSuite::test_LC ( )
inline

Definition at line 469 of file coeffs_test.h.

470 {
472 }
void simple(const n_coeffType _type)
Definition: coeffs_test.h:380
@ n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:41

◆ test_LR()

void CoeffsTestSuite::test_LR ( )
inline

Definition at line 464 of file coeffs_test.h.

465 {
467 }
@ n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:33

◆ test_Q()

void CoeffsTestSuite::test_Q ( )
inline

Definition at line 387 of file coeffs_test.h.

388 {
389 simple(n_Q);
390 }
@ n_Q
rational (GMP) numbers
Definition: coeffs.h:30

◆ test_Q_special()

void CoeffsTestSuite::test_Q_special ( )
inline

Definition at line 474 of file coeffs_test.h.

475 {
476 const coeffs cf = nInitChar(n_Q, NULLp);
477
478 if (cf == NULLp)
479 clog << ( "Test: could not get this coeff. domain" );
480
481 TS_ASSERT_DIFFERS(cf->cfCoeffWrite, NULLp);
482
483 if (cf->cfCoeffWrite != NULL )
484 {
485 clog << "Coeff-domain: " << endl;
487 }
488
489 number q1 = n_Init(21, cf);
490 number q2 = n_Init(2, cf);
491 number q3 = n_Div(q1, q2, cf);
492 number q4 = n_Init(30, cf);
493 number q5 = n_Mult(q3, q4, cf);
494 TS_ASSERT(n_Test(q5, cf));
495 Print("21/2 * 30 = %ld\n", n_Int(q5, cf));
496 TS_ASSERT(n_Test(q5, cf));
497 n_Delete(&q1, cf);
498 n_Delete(&q2, cf);
499 n_Delete(&q3, cf);
500 n_Delete(&q4, cf);
501 n_Delete(&q5, cf);
502 }
#define TS_ASSERT_DIFFERS(x, y)
Definition: TestSuite.h:287
#define NULLp
Definition: auxiliary.h:108
CanonicalForm cf
Definition: cfModGcd.cc:4083
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:633
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:544
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
Definition: coeffs.h:716
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:709
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:612
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:413
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:452
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:535
#define Print
Definition: emacs.cc:80
The main handler for Singular numbers which are suitable for Singular polynomials.
#define NULL
Definition: omList.c:12
void PrintLn()
Definition: reporter.cc:310

◆ test_R()

void CoeffsTestSuite::test_R ( )
inline

Definition at line 392 of file coeffs_test.h.

393 {
394 simple(n_R);
395 }
@ n_R
single prescision (6,6) real numbers
Definition: coeffs.h:31

◆ test_Z()

void CoeffsTestSuite::test_Z ( )
inline

Definition at line 398 of file coeffs_test.h.

399 {
400#ifdef HAVE_RINGS
401 simple(n_Z); // No need in GMP?
402#endif
403 }
@ n_Z
only used if HAVE_RINGS is defined
Definition: coeffs.h:43

◆ test_Z2m2()

void CoeffsTestSuite::test_Z2m2 ( )
inline

Definition at line 455 of file coeffs_test.h.

456 {
457#ifdef HAVE_RINGS
458 n_coeffType type = n_Z2m;
459
460 TS_ASSERT( Test(type, (void*) 2) );
461#endif
462 }
@ n_Z2m
only used if HAVE_RINGS is defined
Definition: coeffs.h:46

◆ test_Z2m4()

void CoeffsTestSuite::test_Z2m4 ( )
inline

Definition at line 358 of file coeffs_test.h.

359 {
360#ifdef HAVE_RINGS
361 n_coeffType type = n_Z2m;
362 TS_ASSERT( Test(type, (void*) 4) );
363#endif
364 }

◆ test_Z2m8()

void CoeffsTestSuite::test_Z2m8 ( )
inline

Definition at line 372 of file coeffs_test.h.

373 {
374#ifdef HAVE_RINGS
375 n_coeffType type = n_Z2m;
376 TS_ASSERT( Test(type, (void*) 8) );
377#endif
378 }

◆ test_Zn3()

void CoeffsTestSuite::test_Zn3 ( )
inline

Definition at line 441 of file coeffs_test.h.

442 {
443#ifdef HAVE_RINGS
444 n_coeffType type = n_Zn;
445
446 ZnmInfo Znmparam;
447 Znmparam.base= (mpz_ptr) omAlloc (sizeof (mpz_t));
448 mpz_init_set_ui (Znmparam.base, 3);
449 Znmparam.exp= 1;
450
451 TS_ASSERT( Test(type, (void*) &Znmparam) );
452#endif
453 }
@ n_Zn
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
#define omAlloc(size)
Definition: omAllocDecl.h:210
mpz_ptr base
Definition: rmodulon.h:18
unsigned long exp
Definition: rmodulon.h:18

◆ test_Zp101()

void CoeffsTestSuite::test_Zp101 ( )
inline

Definition at line 366 of file coeffs_test.h.

367 {
368 n_coeffType type = n_Zp;
369 TS_ASSERT( Test(type, (void*) 101) );
370 }
@ n_Zp
\F{p < 2^31}
Definition: coeffs.h:29

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