Changeset bfde6c in git for libpolys/tests


Ignore:
Timestamp:
Apr 27, 2011, 1:01:09 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
b5b9dc3fbf31410fce6496f383303df8ed1e5461
Parents:
b7d7eb00647832d8b7ba2d7f853accc84ba835b5
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-04-27 13:01:09+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:31:29+01:00
Message:
FIX: some silly bugs in tests...
TODO: correct assumes...?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/tests/polys_test.h

    rb7d7eb rbfde6c  
    5555namespace
    5656{
     57 
    5758  void PrintRing(const ring r)
    5859  {
     
    100101void TestSum(const ring r, const unsigned long N)
    101102{
     103  TS_ASSERT_DIFFERS( r    , NULLp);
     104  TS_ASSERT_DIFFERS( r->cf, NULLp);
     105 
     106 
    102107  clog << ( _2S("TEST: sum[0..") + _2S(N) + "]: ");
    103108  clog << endl;
     
    110115  clog<< "poly(N*(N+1)/2) (int: " << ssss << "): "; PrintSized(sum1, r);
    111116
    112   poly s, ss, i, res;
     117  poly s, ss, i, res; res = NULL;
    113118
    114119  s = p_Init(N  , r);
     
    120125
    121126  number t = n_Init(2, r->cf);
    122   clog<< "number(2): "; PrintSized(i, r); 
     127  clog<< "number(2): "; PrintSized(t, r->cf); 
    123128
    124129  if( !n_IsZero( t, r->cf) )
    125130  {
    126     TS_ASSERT( n_DivBy(p_GetCoeff(i, r), t, r->cf) );
    127     res = p_Div_nn(i, t, r); i = NULL;
    128  
     131    if( i != NULL )
     132    {
     133      number ii = p_GetCoeff(i, r);
     134      clog<< "number(poly(N)*poly(N+1)): "; PrintSized(ii, r->cf); 
     135
     136      TS_ASSERT( n_DivBy(ii, t, r->cf) );
     137      res = p_Div_nn(i, t, r); i = NULL;
     138    }
     139   
     140     
     141
    129142    clog<< "(poly(N)*poly(N+1))/number(2): "; PrintSized(res, r);
    130     poly d = p_Sub(res, sum1, r);
    131    
     143    poly d = p_Sub(p_Copy(res, r), p_Copy(sum1, r), r);
     144
    132145    if( d != NULL )
    133146      TS_ASSERT( n_IsZeroDivisor(p_GetCoeff(d, r), r->cf) );
    134    
     147
    135148    Delete(d, r);
    136    
     149
    137150    if( n_GetChar(r->cf) == 0 )
    138151    {
Note: See TracChangeset for help on using the changeset viewer.