Changeset f323dd1 in git for libpolys/tests/coeffs_test.h


Ignore:
Timestamp:
Feb 29, 2012, 5:18:58 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
8d8cd944663cf80b3fd163a42279526ce163a5fd
Parents:
d8b0f69f9828897dca663d5bb516369b1b0ac64a
Message:
chg: move feResource to findexec lib
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/tests/coeffs_test.h

    rd8b0f69 rf323dd1  
    55
    66#include <reporter/reporter.h>
    7 #include <resources/feResource.h>
     7#include <findexec/feResource.h>
    88
    99#include <coeffs/coeffs.h>
     
    3535
    3636  const unsigned long ssss = (N * (N+1)) / 2;
    37  
     37
    3838  number sum1 = n_Init(ssss, r);
    3939  clog<< "N*(N+1)/2 (int: " << ssss << "): "; PrintSized(sum1, r);
     
    4545  ndInpMult(s, i, r);
    4646  n_Delete(&i, r);
    47  
    48   clog<< "N*(N+1): ("<< N*(N+1) << ")"; PrintSized(s, r); 
    49  
     47
     48  clog<< "N*(N+1): ("<< N*(N+1) << ")"; PrintSized(s, r);
     49
    5050  i = n_Init(2, r);
    51   clog<< "2: "; PrintSized(i, r); 
     51  clog<< "2: "; PrintSized(i, r);
    5252
    5353  if( !n_IsZero( i, r) )
     
    5656    TS_ASSERT( n_DivBy(s, i, r) );
    5757#endif
    58      
     58
    5959    res = n_Div(s, i, r);
    60  
     60
    6161    clog<< "N*(N+1)/2: "; PrintSized(res, r);
    6262
     
    6565    TS_ASSERT( n_IsZeroDivisor(d, r) );
    6666    n_Delete(&d, r);
    67    
     67
    6868    if( n_GetChar(r) == 0 )
    6969    {
     
    7373  } else
    7474    TS_ASSERT_EQUALS( n_GetChar(r), 2);
    75  
     75
    7676
    7777  n_Delete(&s, r);  n_Delete(&i, r);
    78  
    79   n_Delete(&sum1, r); n_Delete(&res, r);   
    80  
     78
     79  n_Delete(&sum1, r); n_Delete(&res, r);
     80
    8181
    8282  s = n_Init(0  , r);
     
    8989    i = n_Neg(i, r);
    9090    ndInpAdd(ss, i, r); // ss -= i
    91    
    92     n_Delete(&i, r);   
     91
     92    n_Delete(&i, r);
    9393  }
    94   clog<< "ss: "; PrintSized(ss, r); 
     94  clog<< "ss: "; PrintSized(ss, r);
    9595
    9696  ss = n_Neg(ss, r); // ss = -ss
    97  
     97
    9898  clog<< "real sum    : "; PrintSized(s, r);
    99   clog<< "real sum(--): "; PrintSized(ss, r); 
     99  clog<< "real sum(--): "; PrintSized(ss, r);
    100100
    101101  TS_ASSERT( n_Equal(s, ss, r) );
    102102  TS_ASSERT( n_Equal(ss, s, r) );
    103103
    104   n_Delete(&s, r);   
    105   n_Delete(&ss, r);   
     104  n_Delete(&s, r);
     105  n_Delete(&ss, r);
    106106
    107107  clog << ( " >>> TEST DONE!" );
     
    118118  number two = n_Init(2, r);
    119119
    120   number t = n_Init(1, r); 
    121   ndInpAdd(t, t, r); 
     120  number t = n_Init(1, r);
     121  ndInpAdd(t, t, r);
    122122  TS_ASSERT( n_Equal(two, t, r) );
    123123  n_Delete(&t, r);
    124  
     124
    125125  if( getCoeffType(r) == n_Q )
    126126  {
    127     number t = n_Init(1, r); 
     127    number t = n_Init(1, r);
    128128    nlInpAdd(t, t, r);
    129129    TS_ASSERT( n_Equal(two, t, r) );
     
    133133
    134134
    135  
     135
    136136  const int N = 66666;
    137137
    138138  number a = n_Init(N, r);
    139    
     139
    140140  clog<< "a: "; PrintSized(a, r);
    141141
    142  
     142
    143143  clog<< "two: "; PrintSized(two, r);
    144144
     
    148148
    149149  clog<< "aa = a + a: "; PrintSized(aa, r);
    150  
     150
    151151  number aa2 = n_Mult(a, two, r);
    152152
     
    154154
    155155  number aa1 = n_Mult(two, a, r);
    156  
     156
    157157  clog<< "aa1 = 2 * a: "; PrintSized(aa1, r);
    158158
     
    162162
    163163  a = n_Sub( aa, aa1, r );
    164  
     164
    165165  clog<< "a = aa - aa1: "; PrintSized(a, r);
    166166
     
    187187
    188188
    189  
     189
    190190  TS_ASSERT( n_Equal(aa, aa1, r) );
    191191  TS_ASSERT( n_Equal(aa, aa2, r) );
    192192  TS_ASSERT( n_Equal(aa1, aa2, r) );
    193  
     193
    194194  TS_ASSERT( n_Equal(aa0, aa, r) );
    195195  TS_ASSERT( n_Equal(aa0, aa1, r) );
     
    209209
    210210
    211  
     211
    212212
    213213BOOLEAN Test(const n_coeffType type, void* p = NULLp)
    214214{
    215  
     215
    216216  clog << endl;
    217217  clog << ( "----------------------- Testing coeffs: [" + _2S(type) +  ", " + _2S(p) + "]: -----------------------");
     
    230230  if( r->cfCoeffWrite != NULL )
    231231  {
    232     clog << "Coeff-domain: "  << endl; 
     232    clog << "Coeff-domain: "  << endl;
    233233    n_CoeffWrite(r); PrintLn();
    234234  }
     
    239239    number z = nfPar (0, r); // also any integer instead of 0//?
    240240    clog << "Generator: "; PrintSized(z, r);
    241     n_Delete(&z, r);   
     241    n_Delete(&z, r);
    242242  }
    243243
    244   clog << "Char: " << n_GetChar(r) << endl; 
    245 
    246  
     244  clog << "Char: " << n_GetChar(r) << endl;
     245
     246
    247247  TS_ASSERT_DIFFERS( r, NULLp );
    248248  nSetChar( r );
     
    262262      TS_ASSERT_EQUALS( r->cfAdd, nlAdd );
    263263      TS_ASSERT_EQUALS( r->cfDelete, nlDelete );
    264      
     264
    265265      TS_ASSERT(  nCoeff_is_Q( r ));
    266266      TS_ASSERT(  nCoeff_is_Domain( r ));
     
    283283      TS_ASSERT( !nCoeff_is_CF( r ));
    284284      TS_ASSERT( !nCoeff_is_Extension( r ));
    285      
     285
    286286      break;
    287287    }
     
    299299      TS_ASSERT_EQUALS( r->cfWrite, ngcWrite );
    300300      TS_ASSERT_EQUALS( r->cfAdd, ngcAdd );
    301       TS_ASSERT_EQUALS( r->cfDelete, ngcDelete );   
     301      TS_ASSERT_EQUALS( r->cfDelete, ngcDelete );
    302302      break;
    303303    }
     
    362362
    363363
    364 class CoeffsTestSuite : public CxxTest::TestSuite 
     364class CoeffsTestSuite : public CxxTest::TestSuite
    365365{
    366366 public:
     
    388388#endif
    389389   }
    390    
     390
    391391   void simple(const n_coeffType _type)
    392392   {
     
    395395     TS_ASSERT( Test(type) );
    396396   }
    397    
     397
    398398   void test_Q()
    399399   {
    400400     simple(n_Q);
    401401   }
    402    
     402
    403403   void test_R()
    404404   {
     
    414414   }
    415415
    416    
     416
    417417   void test_GF_toobig()
    418418   {
     
    427427     TS_ASSERT( !Test(type, (void*) &param) );
    428428
    429       // it should not be used by numbers... right? 
     429      // it should not be used by numbers... right?
    430430      // TODO: what is our policy wrt param-pointer-ownership?
    431431   }
     
    445445     TS_ASSERT( Test(type, (void*) &param) );
    446446
    447       // it should not be used by numbers... right? 
     447      // it should not be used by numbers... right?
    448448      // TODO: what is our policy wrt param-pointer-ownership?
    449449   }
    450    
     450
    451451
    452452   void test_Zn3()
     
    472472     simple(n_long_R);
    473473   }
    474    
     474
    475475   void test_LC()
    476476   {
    477477     simple(n_long_C);
    478478   }
    479    
     479
    480480   void test_Q_special()
    481481   {
     
    489489     if (cf->cfCoeffWrite != NULL )
    490490     {
    491        clog << "Coeff-domain: "  << endl; 
     491       clog << "Coeff-domain: "  << endl;
    492492       n_CoeffWrite(cf); PrintLn();
    493493     }
    494      
     494
    495495     number q1 = n_Init(21, cf);
    496496     number q2 = n_Init(2, cf);
Note: See TracChangeset for help on using the changeset viewer.