Changeset 17d2dd in git


Ignore:
Timestamp:
Aug 26, 2010, 1:03:32 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
5df8564755ca12f19e691c2d185f6e448de3d45d
Parents:
8a455ce52a6e0d2267bc47a872409b7539136770
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2010-08-26 13:03:32+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:26+01:00
Message:
More testing, better output... more TODOs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • coeffs/test.cc

    r8a455c r17d2dd  
    1919
    2020#include <iostream>
     21
    2122using namespace std;
    2223
     
    2526{
    2627  number a = n_Init(666, r);
     28 
     29  StringSetS("a: ");
    2730  n_Test(a,r);
    28  
    29   number b = n_Add(a, a, r);
    30   n_Test(b,r);
    31 
    32   StringSetS("a: "); n_Write(a, r);PrintS(StringAppend("\n"));
    33   StringSetS("b: "); n_Write(b, r);PrintS(StringAppend("\n"));
     31  n_Write(a, r);
     32  PrintS(StringAppend("\n"));
     33
     34  number two = n_Init(2, r);
     35 
     36  StringSetS("two: ");
     37  n_Test(two,r);
     38  n_Write(two, r);
     39  PrintS(StringAppend("\n"));
     40
     41
     42  number aa = n_Add(a, a, r);
     43
     44  StringSetS("aa = a + a: ");
     45  n_Test(aa,r); n_Write(aa, r);
     46  PrintS(StringAppend("\n"));
     47
     48 
     49  number aa2 = n_Mult(a, two, r);
     50
     51  StringSetS("aa2 = a * 2: ");
     52  n_Test(aa2, r); n_Write(aa2, r);
     53  PrintS(StringAppend("\n"));
     54
     55  number aa1 = n_Mult(two, a, r);
     56
     57 
     58  StringSetS("aa1 = 2 * a: ");
     59  n_Test(aa1,r); n_Write(aa1, r);
     60  PrintS(StringAppend("\n"));
     61
    3462
    3563  n_Delete(&a, r);
    36   n_Delete(&b, r);
     64  n_Delete(&two, r);
     65
     66 
     67  if( !n_Equal(aa, aa1, r) )
     68    WarnS("ERROR: aa != aa1  !!!\n");
     69
     70  if( !n_Equal(aa, aa2, r) )
     71    WarnS("ERROR: aa != aa2  !!!\n");
     72
     73  if( !n_Equal(aa1, aa2, r) )
     74    WarnS("ERROR: aa1 != aa2  !!!\n");
     75 
     76
     77 
     78
     79  n_Delete(&aa, r);
     80  n_Delete(&aa1, r);
     81  n_Delete(&aa2, r);
    3782
    3883  return false;
     
    4186
    4287
     88namespace
     89{
     90  static inline ostream& operator<< (ostream& o, const n_coeffType& type)
     91  {
     92#define CASE(A) case A: return o << (" " # A) << " ";
     93    switch( type )
     94    {
     95      CASE(n_unknown);
     96      CASE(n_Zp);
     97      CASE(n_Q);
     98      CASE(n_R);
     99      CASE(n_GF);
     100      CASE(n_long_R);
     101      CASE(n_Zp_a);
     102      CASE(n_Q_a);
     103      CASE(n_long_C);
     104      CASE(n_Z);
     105      CASE(n_Zn);
     106      CASE(n_Zpn);
     107      CASE(n_Z2m);
     108      CASE(n_CF);
     109      default: return o << "Unknown type: [" << (const unsigned long) type << "]"; 
     110    }   
     111#undef CASE
     112    return o;
     113  };
     114};
     115 
     116
    43117bool Test(const n_coeffType type, void* p = NULL)
    44118{
    45 
    46119  cout  << endl << "----------------------- Testing coeffs: [" << type <<
    47120                "]: -----------------------" << endl;
     
    141214    c ++;
    142215
    143   type = nRegister( n_long_R, ngfInitChar); assume( type == n_long_R );
    144   if( Test(type) )
    145     c ++;
    146 
    147   type = nRegister( n_long_C, ngcInitChar); assume( type == n_long_C );
    148   if( Test(type) )
    149     c ++;
    150 
    151216
    152217#ifdef HAVE_RINGS
     
    158223  if( Test(type, (void*) 2) )
    159224    c ++;
    160 
     225#endif
     226
     227
     228
     229
     230  // the following leads to the error: "multiple definition of `fePathSep'"
     231  // TODO: Oleksandr/Martin
     232//   type = nRegister( n_GF, nfInitChar); assume( type == n_GF );
     233//   if( Test(type) )
     234//     c ++;
     235 
     236
     237  // BUG: in n_Equal!
     238  // TODO: Oleksandr/Christian
     239//   type = nRegister( n_long_R, ngfInitChar); assume( type == n_long_R );
     240//   if( Test(type) )
     241//     c ++;
     242//
     243//   type = nRegister( n_long_C, ngcInitChar); assume( type == n_long_C );
     244//   if( Test(type) )
     245//     c ++;
     246 
     247 
     248
     249
     250
     251#ifdef HAVE_RINGS
    161252  type = nRegister( n_Zn, nrnInitChar); assume( type == n_Zn );
    162253
    163   // BUG here!
    164   // TODO: Frank (cmp. with the previous code)
    165   // Note: the parameter 'm' is ignored now in nrnSetExp!!!
     254  // trivial BUG here: the parameter 'm' is ignored now in nrnSetExp!!!
     255  // TODO: Frank
    166256  if( Test(type, (void*) 3) )
    167257    c ++;
    168 
    169258#endif
    170259
    171 /* 
    172   // TODO: Hans (the following needs resources, e.g. feFopen)
    173   type = nRegister( n_GF, nfInitChar); assume( type == n_GF );
    174   if( Test(type) )
    175     c ++;
    176 */
     260 
    177261 
    178262  return c;
Note: See TracChangeset for help on using the changeset viewer.