Changeset 4f684a in git


Ignore:
Timestamp:
Apr 18, 2011, 9:06:26 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
Children:
0ffdec76b9340ac8c557e00b7c25bf36046ecf5b
Parents:
845729b0cdf699d3eba18bc144ad8e14f46e1c99
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-04-18 21:06:26+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:31:17+01:00
Message:
ADD: unit tests for polys
Location:
libpolys/tests
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/tests/Makefile.am

    r845729b r4f684a  
    22
    33## for testing...
    4 AM_LDFLAGS = -L${top_builddir}/coeffs -L${top_builddir}/reporter -L${top_builddir}/resources -L${top_builddir}/misc -L${top_builddir}/../omalloc
     4AM_LDFLAGS = -L${top_builddir}/polys -L${top_builddir}/coeffs -L${top_builddir}/reporter -L${top_builddir}/resources -L${top_builddir}/misc -L${top_builddir}/../omalloc
    55
    66
     
    1414INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${srcdir} ${GMP_CFLAGS}
    1515
    16 TESTS = simple_test coeffs_test
     16
     17TESTS = simple_test coeffs_test polys_test
    1718check_PROGRAMS = $(TESTS)
    1819
    1920simple_test_SOURCES = simple_test_runner.cpp
    20 
    2121coeffs_test_SOURCES = coeffs_test_runner.cpp
     22polys_test_SOURCES = polys_test_runner.cpp
    2223
    2324coeffs_test_LDADD = -lcoeffs_g ${GMP_LIBS} -lresources_g -lreporter_g -lmisc -lomalloc_debug
     25polys_test_LDADD = -lpolys_g $(coeffs_test_LDADD)
    2426
    2527
    26 BUILT_SOURCES = $(simple_test_SOURCES) $(coeffs_test_SOURCES)
     28BUILT_SOURCES = $(simple_test_SOURCES) $(coeffs_test_SOURCES) $(polys_test_SOURCES)
    2729
    2830
     
    3335coeffs_test_runner.cpp: coeffs_test.h
    3436        ${srcdir}/cxxtestgen.pl --no-eh -o $@ --error-printer $^
     37
     38polys_test_runner.cpp: polys_test.h
     39        ${srcdir}/cxxtestgen.pl --no-eh -o $@ --error-printer $^
  • libpolys/tests/coeffs_test.h

    r845729b r4f684a  
    2222
    2323
    24 #include <iostream>
     24#include "common.h"
    2525using namespace std;
    2626
    2727
    28 #pragma GCC diagnostic ignored "-Wwrite-strings"
    2928namespace
    3029{
    31   static inline ostream& operator<< (ostream& o, const n_coeffType& type)
    32   {
    33 #define CASE(A) case A: return o << (" " # A) << " ";
    34     switch( type )
    35     {
    36       CASE(n_unknown);
    37       CASE(n_Zp);
    38       CASE(n_Q);
    39       CASE(n_R);
    40       CASE(n_GF);
    41       CASE(n_long_R);
    42       CASE(n_Zp_a);
    43       CASE(n_Q_a);
    44       CASE(n_long_C);
    45       CASE(n_Z);
    46       CASE(n_Zn);
    47       CASE(n_Zpn);
    48       CASE(n_Z2m);
    49       CASE(n_CF);
    50       default: return o << "Unknown type: [" << (const unsigned long) type << "]"; 
    51     }   
    52 #undef CASE
    53     return o;
    54   }
    55 
    56   template<typename T>
    57       static inline std::string _2S(T i)
    58   {
    59     std::stringstream ss;
    60     ss << i;
    61 //    std::string s = ss.str();
    62     return ss.str();
    63   }
    64 
    65 
    66   static inline std::string _2S(number a, const coeffs r)
    67   {
    68     n_Test(a,r);
    69     StringSetS(""); 
    70     n_Write(a, r);
    71 
    72     const char* s = StringAppendS("");
    73    
    74     std::stringstream ss;  ss << s;
    75 
    76     StringSetS(""); 
    77     return ss.str();
    78    
    79   }
    80  
    81 
    82 }
    83 
    84 void PrintSized(/*const*/ number a, const coeffs r, BOOLEAN eoln = TRUE)
    85 {
    86   clog << _2S(a, r) << ", of size: " << n_Size(a, r);
    87  
    88   if( eoln )
    89     clog << endl; 
    90 }
    91  
    9230
    9331void TestSum(const coeffs r, const unsigned long N)
     
    365303
    366304
     305}
     306
    367307
    368308class CoeffsTestSuite : public CxxTest::TestSuite
    369309{
    370310 public:
    371    void test_dummy()
    372    {
    373      float fnum = 2.00001f;             
    374      TS_ASSERT_DELTA (fnum, 2.0f, 0.0001f);
    375      
    376    }
    377 
     311//   void test_dummy() { float fnum = 2.00001f; TS_ASSERT_DELTA (fnum, 2.0f, 0.0001f);  }
    378312
    379313   void test_Z2m4()
Note: See TracChangeset for help on using the changeset viewer.