Changeset 912


Ignore:
Timestamp:
Sep 7, 2011, 7:17:07 PM (8 years ago)
Author:
sam
Message:

test: replace CppUnit with our LolUnit test suite.

CppUnit is really too large for our needs, would require to be precompiled
for many platforms, in all combinations of debug and release modes, with
additional variants for libstdc++ versions. We replace it with our own
lightweight implementation, LolUnit. Good riddance.

Location:
trunk
Files:
2 added
84 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/build-mingw

    r876 r912  
    1111
    1212M4PATH="$M4PATH:./contrib/gtk-2.22.1/share/aclocal"
    13 M4PATH="$M4PATH:./contrib/cppunit-1.12.2/share/aclocal"
    1413export M4PATH # This looks necessary
    1514
    1615PKG_CONFIG_PATH="$PKG_CONFIG_PATH:`pwd`/contrib/gtkglarea-2.0.1/lib/pkgconfig"
    17 PKG_CONFIG_PATH="$PKG_CONFIG_PATH:`pwd`/contrib/cppunit-1.12.2/lib/pkgconfig"
    1816export PKG_CONFIG_PATH # This looks necessary, too
    1917
     
    3735CPPFLAGS="$CPPFLAGS -I`pwd`/contrib/gtkglarea-2.0.1/include"
    3836
    39 # CppUnit include path
    40 CPPFLAGS="$CPPFLAGS -I`pwd`/contrib/cppunit-1.12.2/include"
    41 
    4237# SDL library path
    4338LDFLAGS="$LDFLAGS -L`pwd`/contrib/sdl-1.2.14/lib"
     
    5247LDFLAGS="$LDFLAGS -L`pwd`/contrib/gtk-2.22.1/bin"
    5348LDFLAGS="$LDFLAGS -L`pwd`/contrib/gtkglarea-2.0.1/lib"
    54 
    55 # CppUnit library path
    56 LDFLAGS="$LDFLAGS -L`pwd`/contrib/cppunit-1.12.2/lib"
    5749
    5850# Prevent issues with GTK+ internals
  • trunk/build/bitten.xml

    r876 r912  
    1515          PATH="$''PATH:./contrib/gtk-2.22.1/bin";
    1616          M4PATH="$''M4PATH:./contrib/gtk-2.22.1/share/aclocal";
    17           M4PATH="$''M4PATH:./contrib/cppunit-1.12.2/share/aclocal";
    1817          PATH="$''PATH" M4PATH="$''M4PATH" ./bootstrap;
    1918          ;;
     
    3534        windows-i386)
    3635          PKG_CONFIG_PATH="$''PKG_CONFIG_PATH:$''PWD/contrib/gtkglarea-2.0.1/lib/pkgconfig";
    37           PKG_CONFIG_PATH="$''PKG_CONFIG_PATH:$''PWD/contrib/cppunit-1.12.2/lib/pkgconfig";
    3836          CPPFLAGS="$''CPPFLAGS -I$''PWD/contrib/sdl-1.2.14/include";
    3937          CPPFLAGS="$''CPPFLAGS -I$''PWD/contrib/sdl-image-1.2.10/include";
     
    4947          CPPFLAGS="$''CPPFLAGS -I$''PWD/contrib/gtk-2.22.1/include/atk-1.0";
    5048          CPPFLAGS="$''CPPFLAGS -I$''PWD/contrib/gtkglarea-2.0.1/include";
    51           CPPFLAGS="$''CPPFLAGS -I$''PWD/contrib/cppunit-1.12.2/include";
    5249          LDFLAGS="$''LDFLAGS -L$''PWD/contrib/sdl-1.2.14/lib";
    5350          LDFLAGS="$''LDFLAGS -L$''PWD/contrib/sdl-image-1.2.10/lib";
     
    5754          LDFLAGS="$''LDFLAGS -L$''PWD/contrib/gtk-2.22.1/bin";
    5855          LDFLAGS="$''LDFLAGS -L$''PWD/contrib/gtkglarea-2.0.1/lib";
    59           LDFLAGS="$''LDFLAGS -L$''PWD/contrib/cppunit-1.12.2/lib";
    6056          CPPFLAGS="$''CPPFLAGS -mms-bitfields";
    6157          LDFLAGS="$''LDFLAGS -static-libgcc -static-libstdc++";
  • trunk/configure.ac

    r884 r912  
    4646AC_ARG_ENABLE(experimental,
    4747  [  --enable-experimental   experimental build (default no)])
    48 
    49 AC_ARG_ENABLE(cppunit,
    50   [  --enable-cppunit        use cppunit for unit tests (autodetected)])
    5148
    5249AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h fastmath.h)
     
    243240
    244241
    245 dnl Use cppunit for unit tests?
    246 PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
    247 AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
    248 
    249 
    250242dnl How to use the Lol Engine inside this tree
    251243LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  • trunk/src/Makefile.am

    r885 r912  
    1212    worldentity.cpp worldentity.h gradient.cpp gradient.h half.cpp half.h \
    1313    platform.cpp platform.h sprite.cpp sprite.h trig.cpp trig.h \
     14    \
     15    lol/unit.h \
    1416    \
    1517    eglapp.cpp eglapp.h \
  • trunk/test/Makefile.am

    r895 r912  
    11
    22AM_CPPFLAGS = -I$(top_srcdir)/src
    3 
    4 if USE_CPPUNIT
    5 cppunit_tests = lol-test
    6 endif
    73
    84bench: lol-bench$(EXEEXT)
     
    139        test x$(MAKE_FSELF) = xno || make_fself sandbox$(EXEEXT) sandbox.self
    1410        test x$(MAKE_FSELF) = xno || make_fself lol-bench$(EXEEXT) lol-bench.self
     11        test x$(MAKE_FSELF) = xno || make_fself lol-test$(EXEEXT) lol-test.self
    1512
    16 CLEANFILES = quad.self sandbox lol-bench.self
     13CLEANFILES = quad.self sandbox lol-bench.self lol-test.self
    1714
    18 noinst_PROGRAMS = quad sandbox lol-bench $(cppunit_tests)
     15noinst_PROGRAMS = quad sandbox lol-bench lol-test
    1916
    20 TESTS = $(cppunit_tests)
     17TESTS = lol-test
    2118
    2219lol_test_SOURCES = lol-test.cpp matrix.cpp half.cpp trig.cpp
    23 lol_test_CXXFLAGS = $(CPPUNIT_CFLAGS)
    2420lol_test_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@
    25 lol_test_LDADD = $(CPPUNIT_LIBS)
    2621lol_test_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@ @PIPI_LIBS@
    2722lol_test_DEPENDENCIES = $(top_builddir)/src/liblol.a
  • trunk/test/half.cpp

    r911 r912  
    1313#endif
    1414
    15 #include <cppunit/extensions/HelperMacros.h>
    16 #include <cppunit/TestCaller.h>
    17 #include <cppunit/TestCase.h>
    18 #include <cppunit/TestSuite.h>
    19 
    2015#include <cmath>
    2116
    2217#include "core.h"
     18#include "lol/unit.h"
    2319
    2420/* Ensure isnan() is present even on systems that don't define it, or
     
    3834{
    3935
    40 class HalfTest : public CppUnit::TestCase
     36LOLUNIT_FIXTURE(HalfTest)
    4137{
    42     CPPUNIT_TEST_SUITE(HalfTest);
    43     CPPUNIT_TEST(test_half_from_float);
    44     CPPUNIT_TEST(test_half_makeaccurate);
    45     CPPUNIT_TEST(test_half_makebits);
    46     CPPUNIT_TEST(test_half_is_nan);
    47     CPPUNIT_TEST(test_half_is_inf);
    48     CPPUNIT_TEST(test_half_is_finite);
    49     CPPUNIT_TEST(test_half_is_normal);
    50     CPPUNIT_TEST(test_half_classify);
    51     CPPUNIT_TEST(test_half_to_float);
    52     CPPUNIT_TEST(test_half_to_int);
    53     CPPUNIT_TEST(test_float_op_half);
    54     CPPUNIT_TEST(test_half_op_float);
    55     CPPUNIT_TEST_SUITE_END();
    56 
    5738public:
    58     HalfTest() : CppUnit::TestCase("Matrix Test") {}
    59 
    60     void setUp()
    61     {
    62     }
    63 
     39    void setUp() {}
    6440    void tearDown() {}
    6541
    66     void test_half_from_float()
     42    LOLUNIT_TEST(test_half_from_float)
    6743    {
    6844        for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++)
     
    7046            half a = (half)pairs[i].f;
    7147            uint16_t b = pairs[i].x;
    72             CPPUNIT_ASSERT_EQUAL(a.bits, b);
    73         }
    74     }
    75 
    76     void test_half_makeaccurate()
     48            LOLUNIT_ASSERT_EQUAL(a.bits, b);
     49        }
     50    }
     51
     52    LOLUNIT_TEST(test_half_makeaccurate)
    7753    {
    7854        for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++)
     
    8056            half a = half::makeaccurate(pairs[i].f);
    8157            uint16_t b = pairs[i].x;
    82             CPPUNIT_ASSERT_EQUAL(a.bits, b);
    83         }
    84     }
    85 
    86     void test_half_makebits()
     58            LOLUNIT_ASSERT_EQUAL(a.bits, b);
     59        }
     60    }
     61
     62    LOLUNIT_TEST(test_half_makebits)
    8763    {
    8864        for (unsigned int i = 0; i < 0x10000; i++)
     
    9066            half a = half::makebits(i);
    9167            uint16_t b = i;
    92             CPPUNIT_ASSERT_EQUAL(a.bits, b);
    93         }
    94     }
    95 
    96     void test_half_is_nan()
    97     {
    98         CPPUNIT_ASSERT(half::makebits(0x7c01).is_nan());
    99         CPPUNIT_ASSERT(half::makebits(0xfc01).is_nan());
    100         CPPUNIT_ASSERT(half::makebits(0x7e00).is_nan());
    101         CPPUNIT_ASSERT(half::makebits(0xfe00).is_nan());
    102 
    103         CPPUNIT_ASSERT(!half::makebits(0x7c00).is_nan());
    104         CPPUNIT_ASSERT(!half::makebits(0xfc00).is_nan());
    105 
    106         CPPUNIT_ASSERT(!half(0.0f).is_nan());
    107         CPPUNIT_ASSERT(!half(-0.0f).is_nan());
    108         CPPUNIT_ASSERT(!half(2.0f).is_nan());
    109         CPPUNIT_ASSERT(!half(-2.0f).is_nan());
    110     }
    111 
    112     void test_half_is_inf()
    113     {
    114         CPPUNIT_ASSERT(half(65536.0f).is_inf());
    115         CPPUNIT_ASSERT(half(-65536.0f).is_inf());
    116 
    117         CPPUNIT_ASSERT(!half(0.0f).is_inf());
    118         CPPUNIT_ASSERT(!half(-0.0f).is_inf());
    119         CPPUNIT_ASSERT(!half(65535.0f).is_inf());
    120         CPPUNIT_ASSERT(!half(-65535.0f).is_inf());
    121 
    122         CPPUNIT_ASSERT(half::makebits(0x7c00).is_inf());
    123         CPPUNIT_ASSERT(half::makebits(0xfc00).is_inf());
    124 
    125         CPPUNIT_ASSERT(!half::makebits(0x7e00).is_inf());
    126         CPPUNIT_ASSERT(!half::makebits(0xfe00).is_inf());
    127     }
    128 
    129     void test_half_is_finite()
    130     {
    131         CPPUNIT_ASSERT(half(0.0f).is_finite());
    132         CPPUNIT_ASSERT(half(-0.0f).is_finite());
    133         CPPUNIT_ASSERT(half(65535.0f).is_finite());
    134         CPPUNIT_ASSERT(half(-65535.0f).is_finite());
    135 
    136         CPPUNIT_ASSERT(!half(65536.0f).is_finite());
    137         CPPUNIT_ASSERT(!half(-65536.0f).is_finite());
    138 
    139         CPPUNIT_ASSERT(!half::makebits(0x7c00).is_finite());
    140         CPPUNIT_ASSERT(!half::makebits(0xfc00).is_finite());
    141 
    142         CPPUNIT_ASSERT(!half::makebits(0x7e00).is_finite());
    143         CPPUNIT_ASSERT(!half::makebits(0xfe00).is_finite());
    144     }
    145 
    146     void test_half_is_normal()
    147     {
    148         CPPUNIT_ASSERT(half(0.0f).is_normal());
    149         CPPUNIT_ASSERT(half(-0.0f).is_normal());
    150         CPPUNIT_ASSERT(half(65535.0f).is_normal());
    151         CPPUNIT_ASSERT(half(-65535.0f).is_normal());
    152 
    153         CPPUNIT_ASSERT(!half(65536.0f).is_normal());
    154         CPPUNIT_ASSERT(!half(-65536.0f).is_normal());
    155 
    156         CPPUNIT_ASSERT(!half::makebits(0x7c00).is_normal());
    157         CPPUNIT_ASSERT(!half::makebits(0xfc00).is_normal());
    158 
    159         CPPUNIT_ASSERT(!half::makebits(0x7e00).is_normal());
    160         CPPUNIT_ASSERT(!half::makebits(0xfe00).is_normal());
    161     }
    162 
    163     void test_half_classify()
     68            LOLUNIT_ASSERT_EQUAL(a.bits, b);
     69        }
     70    }
     71
     72    LOLUNIT_TEST(test_half_is_nan)
     73    {
     74        LOLUNIT_ASSERT(half::makebits(0x7c01).is_nan());
     75        LOLUNIT_ASSERT(half::makebits(0xfc01).is_nan());
     76        LOLUNIT_ASSERT(half::makebits(0x7e00).is_nan());
     77        LOLUNIT_ASSERT(half::makebits(0xfe00).is_nan());
     78
     79        LOLUNIT_ASSERT(!half::makebits(0x7c00).is_nan());
     80        LOLUNIT_ASSERT(!half::makebits(0xfc00).is_nan());
     81
     82        LOLUNIT_ASSERT(!half(0.0f).is_nan());
     83        LOLUNIT_ASSERT(!half(-0.0f).is_nan());
     84        LOLUNIT_ASSERT(!half(2.0f).is_nan());
     85        LOLUNIT_ASSERT(!half(-2.0f).is_nan());
     86    }
     87
     88    LOLUNIT_TEST(test_half_is_inf)
     89    {
     90        LOLUNIT_ASSERT(half(65536.0f).is_inf());
     91        LOLUNIT_ASSERT(half(-65536.0f).is_inf());
     92
     93        LOLUNIT_ASSERT(!half(0.0f).is_inf());
     94        LOLUNIT_ASSERT(!half(-0.0f).is_inf());
     95        LOLUNIT_ASSERT(!half(65535.0f).is_inf());
     96        LOLUNIT_ASSERT(!half(-65535.0f).is_inf());
     97
     98        LOLUNIT_ASSERT(half::makebits(0x7c00).is_inf());
     99        LOLUNIT_ASSERT(half::makebits(0xfc00).is_inf());
     100
     101        LOLUNIT_ASSERT(!half::makebits(0x7e00).is_inf());
     102        LOLUNIT_ASSERT(!half::makebits(0xfe00).is_inf());
     103    }
     104
     105    LOLUNIT_TEST(test_half_is_finite)
     106    {
     107        LOLUNIT_ASSERT(half(0.0f).is_finite());
     108        LOLUNIT_ASSERT(half(-0.0f).is_finite());
     109        LOLUNIT_ASSERT(half(65535.0f).is_finite());
     110        LOLUNIT_ASSERT(half(-65535.0f).is_finite());
     111
     112        LOLUNIT_ASSERT(!half(65536.0f).is_finite());
     113        LOLUNIT_ASSERT(!half(-65536.0f).is_finite());
     114
     115        LOLUNIT_ASSERT(!half::makebits(0x7c00).is_finite());
     116        LOLUNIT_ASSERT(!half::makebits(0xfc00).is_finite());
     117
     118        LOLUNIT_ASSERT(!half::makebits(0x7e00).is_finite());
     119        LOLUNIT_ASSERT(!half::makebits(0xfe00).is_finite());
     120    }
     121
     122    LOLUNIT_TEST(test_half_is_normal)
     123    {
     124        LOLUNIT_ASSERT(half(0.0f).is_normal());
     125        LOLUNIT_ASSERT(half(-0.0f).is_normal());
     126        LOLUNIT_ASSERT(half(65535.0f).is_normal());
     127        LOLUNIT_ASSERT(half(-65535.0f).is_normal());
     128
     129        LOLUNIT_ASSERT(!half(65536.0f).is_normal());
     130        LOLUNIT_ASSERT(!half(-65536.0f).is_normal());
     131
     132        LOLUNIT_ASSERT(!half::makebits(0x7c00).is_normal());
     133        LOLUNIT_ASSERT(!half::makebits(0xfc00).is_normal());
     134
     135        LOLUNIT_ASSERT(!half::makebits(0x7e00).is_normal());
     136        LOLUNIT_ASSERT(!half::makebits(0xfe00).is_normal());
     137    }
     138
     139    LOLUNIT_TEST(test_half_classify)
    164140    {
    165141        for (uint32_t i = 0; i < 0x10000; i++)
     
    168144            if (h.is_nan())
    169145            {
    170                 CPPUNIT_ASSERT(!h.is_inf());
    171                 CPPUNIT_ASSERT(!h.is_normal());
    172                 CPPUNIT_ASSERT(!h.is_finite());
     146                LOLUNIT_ASSERT(!h.is_inf());
     147                LOLUNIT_ASSERT(!h.is_normal());
     148                LOLUNIT_ASSERT(!h.is_finite());
    173149            }
    174150            else if (h.is_inf())
    175151            {
    176                 CPPUNIT_ASSERT(!h.is_normal());
    177                 CPPUNIT_ASSERT(!h.is_finite());
     152                LOLUNIT_ASSERT(!h.is_normal());
     153                LOLUNIT_ASSERT(!h.is_finite());
    178154            }
    179155            else
    180156            {
    181                 CPPUNIT_ASSERT(h.is_finite());
    182             }
    183         }
    184     }
    185 
    186     void test_half_to_float()
     157                LOLUNIT_ASSERT(h.is_finite());
     158            }
     159        }
     160    }
     161
     162    LOLUNIT_TEST(test_half_to_float)
    187163    {
    188164        for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++)
     
    190166            float a = (float)half::makebits(pairs[i].x);
    191167            float b = pairs[i].f;
    192             CPPUNIT_ASSERT_EQUAL(a, b);
     168            LOLUNIT_ASSERT_EQUAL(a, b);
    193169        }
    194170
     
    200176            if (h.is_nan())
    201177            {
    202                 CPPUNIT_ASSERT(isnan(f));
    203                 CPPUNIT_ASSERT(g.is_nan());
     178                LOLUNIT_ASSERT(isnan(f));
     179                LOLUNIT_ASSERT(g.is_nan());
    204180            }
    205181            else
    206182            {
    207                 CPPUNIT_ASSERT(!isnan(f));
    208                 CPPUNIT_ASSERT_EQUAL(g.bits, h.bits);
    209             }
    210         }
    211     }
    212 
    213     void test_half_to_int()
    214     {
    215         CPPUNIT_ASSERT_EQUAL((int)(half)(0.0f), 0);
    216         CPPUNIT_ASSERT_EQUAL((int)(half)(-0.0f), 0);
    217         CPPUNIT_ASSERT_EQUAL((int)(half)(0.9f), 0);
    218         CPPUNIT_ASSERT_EQUAL((int)(half)(-0.9f), 0);
    219         CPPUNIT_ASSERT_EQUAL((int)(half)(1.0f), 1);
    220         CPPUNIT_ASSERT_EQUAL((int)(half)(-1.0f), -1);
    221         CPPUNIT_ASSERT_EQUAL((int)(half)(1.9f), 1);
    222         CPPUNIT_ASSERT_EQUAL((int)(half)(-1.9f), -1);
    223         CPPUNIT_ASSERT_EQUAL((int)(half)(65504.0f), 65504);
    224         CPPUNIT_ASSERT_EQUAL((int)(half)(-65504.0f), -65504);
    225     }
    226 
    227     void test_float_op_half()
     183                LOLUNIT_ASSERT(!isnan(f));
     184                LOLUNIT_ASSERT_EQUAL(g.bits, h.bits);
     185            }
     186        }
     187    }
     188
     189    LOLUNIT_TEST(test_half_to_int)
     190    {
     191        LOLUNIT_ASSERT_EQUAL((int)(half)(0.0f), 0);
     192        LOLUNIT_ASSERT_EQUAL((int)(half)(-0.0f), 0);
     193        LOLUNIT_ASSERT_EQUAL((int)(half)(0.9f), 0);
     194        LOLUNIT_ASSERT_EQUAL((int)(half)(-0.9f), 0);
     195        LOLUNIT_ASSERT_EQUAL((int)(half)(1.0f), 1);
     196        LOLUNIT_ASSERT_EQUAL((int)(half)(-1.0f), -1);
     197        LOLUNIT_ASSERT_EQUAL((int)(half)(1.9f), 1);
     198        LOLUNIT_ASSERT_EQUAL((int)(half)(-1.9f), -1);
     199        LOLUNIT_ASSERT_EQUAL((int)(half)(65504.0f), 65504);
     200        LOLUNIT_ASSERT_EQUAL((int)(half)(-65504.0f), -65504);
     201    }
     202
     203    LOLUNIT_TEST(test_float_op_half)
    228204    {
    229205        half zero = 0;
     
    232208
    233209        float a = zero + one;
    234         CPPUNIT_ASSERT_EQUAL(1.0f, a);
     210        LOLUNIT_ASSERT_EQUAL(1.0f, a);
    235211        a += zero;
    236         CPPUNIT_ASSERT_EQUAL(1.0f, a);
     212        LOLUNIT_ASSERT_EQUAL(1.0f, a);
    237213        a -= zero;
    238         CPPUNIT_ASSERT_EQUAL(1.0f, a);
     214        LOLUNIT_ASSERT_EQUAL(1.0f, a);
    239215        a *= one;
    240         CPPUNIT_ASSERT_EQUAL(1.0f, a);
     216        LOLUNIT_ASSERT_EQUAL(1.0f, a);
    241217        a /= one;
    242         CPPUNIT_ASSERT_EQUAL(1.0f, a);
     218        LOLUNIT_ASSERT_EQUAL(1.0f, a);
    243219
    244220        float b = one + zero;
    245         CPPUNIT_ASSERT_EQUAL(1.0f, b);
     221        LOLUNIT_ASSERT_EQUAL(1.0f, b);
    246222        b += one;
    247         CPPUNIT_ASSERT_EQUAL(2.0f, b);
     223        LOLUNIT_ASSERT_EQUAL(2.0f, b);
    248224        b *= two;
    249         CPPUNIT_ASSERT_EQUAL(4.0f, b);
     225        LOLUNIT_ASSERT_EQUAL(4.0f, b);
    250226        b -= two;
    251         CPPUNIT_ASSERT_EQUAL(2.0f, b);
     227        LOLUNIT_ASSERT_EQUAL(2.0f, b);
    252228        b /= two;
    253         CPPUNIT_ASSERT_EQUAL(1.0f, b);
     229        LOLUNIT_ASSERT_EQUAL(1.0f, b);
    254230
    255231        float c = one - zero;
    256         CPPUNIT_ASSERT_EQUAL(1.0f, c);
     232        LOLUNIT_ASSERT_EQUAL(1.0f, c);
    257233
    258234        float d = two - one;
    259         CPPUNIT_ASSERT_EQUAL(1.0f, d);
     235        LOLUNIT_ASSERT_EQUAL(1.0f, d);
    260236
    261237        float e = two + (-one);
    262         CPPUNIT_ASSERT_EQUAL(1.0f, e);
     238        LOLUNIT_ASSERT_EQUAL(1.0f, e);
    263239
    264240        float f = (two * two) / (one + one);
    265         CPPUNIT_ASSERT_EQUAL(2.0f, f);
    266     }
    267 
    268     void test_half_op_float()
     241        LOLUNIT_ASSERT_EQUAL(2.0f, f);
     242    }
     243
     244    LOLUNIT_TEST(test_half_op_float)
    269245    {
    270246        half zero = 0;
     
    274250
    275251        half a = one + 0.0f;
    276         CPPUNIT_ASSERT_EQUAL(one.bits, a.bits);
     252        LOLUNIT_ASSERT_EQUAL(one.bits, a.bits);
    277253        a += 0.0f;
    278         CPPUNIT_ASSERT_EQUAL(one.bits, a.bits);
     254        LOLUNIT_ASSERT_EQUAL(one.bits, a.bits);
    279255        a -= 0.0f;
    280         CPPUNIT_ASSERT_EQUAL(one.bits, a.bits);
     256        LOLUNIT_ASSERT_EQUAL(one.bits, a.bits);
    281257        a *= 1.0f;
    282         CPPUNIT_ASSERT_EQUAL(one.bits, a.bits);
     258        LOLUNIT_ASSERT_EQUAL(one.bits, a.bits);
    283259        a /= 1.0f;
    284         CPPUNIT_ASSERT_EQUAL(one.bits, a.bits);
     260        LOLUNIT_ASSERT_EQUAL(one.bits, a.bits);
    285261
    286262        half b = one + 0.0f;
    287         CPPUNIT_ASSERT_EQUAL(one.bits, b.bits);
     263        LOLUNIT_ASSERT_EQUAL(one.bits, b.bits);
    288264        b += 1.0f;
    289         CPPUNIT_ASSERT_EQUAL(two.bits, b.bits);
     265        LOLUNIT_ASSERT_EQUAL(two.bits, b.bits);
    290266        b *= 2.0f;
    291         CPPUNIT_ASSERT_EQUAL(four.bits, b.bits);
     267        LOLUNIT_ASSERT_EQUAL(four.bits, b.bits);
    292268        b -= 2.0f;
    293         CPPUNIT_ASSERT_EQUAL(two.bits, b.bits);
     269        LOLUNIT_ASSERT_EQUAL(two.bits, b.bits);
    294270        b /= 2.0f;
    295         CPPUNIT_ASSERT_EQUAL(one.bits, b.bits);
     271        LOLUNIT_ASSERT_EQUAL(one.bits, b.bits);
    296272
    297273        half c = 1.0f - zero;
    298         CPPUNIT_ASSERT_EQUAL(one.bits, c.bits);
     274        LOLUNIT_ASSERT_EQUAL(one.bits, c.bits);
    299275
    300276        half d = 2.0f - one;
    301         CPPUNIT_ASSERT_EQUAL(one.bits, d.bits);
     277        LOLUNIT_ASSERT_EQUAL(one.bits, d.bits);
    302278
    303279        half e = 2.0f + (-one);
    304         CPPUNIT_ASSERT_EQUAL(one.bits, e.bits);
     280        LOLUNIT_ASSERT_EQUAL(one.bits, e.bits);
    305281
    306282        half f = (2.0f * two) / (1.0f + one);
    307         CPPUNIT_ASSERT_EQUAL(two.bits, f.bits);
     283        LOLUNIT_ASSERT_EQUAL(two.bits, f.bits);
    308284    }
    309285
     
    330306};
    331307
    332 CPPUNIT_TEST_SUITE_REGISTRATION(HalfTest);
     308LOLUNIT_SETUP_FIXTURE(HalfTest);
    333309
    334310} /* namespace lol */
  • trunk/test/lol-test.cpp

    r911 r912  
    1515#include <cstdio>
    1616
    17 #include <cppunit/TextTestRunner.h>
    18 #include <cppunit/extensions/TestFactoryRegistry.h>
     17#include <lol/unit.h>
    1918
    20 int main(int argc, char *argv[])
     19int main(void)
    2120{
    22     CppUnit::TextTestRunner runner;
    23     runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
    24 
    25     int ret = !runner.run();
    26 
    27 #if defined _WIN32
    28     getchar();
    29 #endif
     21    lol::TestRunner runner;
     22    int ret = !runner.Run();
    3023    return ret;
    3124}
  • trunk/test/matrix.cpp

    r907 r912  
    1313#endif
    1414
    15 #include <cppunit/extensions/HelperMacros.h>
    16 #include <cppunit/TestCaller.h>
    17 #include <cppunit/TestCase.h>
    18 #include <cppunit/TestSuite.h>
    19 
    2015#include "core.h"
     16#include "lol/unit.h"
    2117
    2218namespace lol
    2319{
    2420
    25 class MatrixTest : public CppUnit::TestCase
     21LOLUNIT_FIXTURE(MatrixTest)
    2622{
    27     CPPUNIT_TEST_SUITE(MatrixTest);
    28     CPPUNIT_TEST(test_vec_eq);
    29     CPPUNIT_TEST(test_vec_lt);
    30     CPPUNIT_TEST(test_vec_unary);
    31     CPPUNIT_TEST(test_vec_cast);
    32     CPPUNIT_TEST(test_mat_det);
    33     CPPUNIT_TEST(test_mat_mul);
    34     CPPUNIT_TEST(test_mat_inv);
    35     CPPUNIT_TEST_SUITE_END();
    36 
    3723public:
    38     MatrixTest() : CppUnit::TestCase("Matrix Test") {}
    39 
    4024    void setUp()
    4125    {
     
    5337    void tearDown() {}
    5438
    55     void test_vec_eq()
     39    LOLUNIT_TEST(test_vec_eq)
    5640    {
    5741        vec2 a2(1.0f, 2.0f);
     
    5943        vec2 c2(1.0f, 0.0f);
    6044
    61         CPPUNIT_ASSERT(a2 == a2);
    62         CPPUNIT_ASSERT(!(a2 != a2));
    63 
    64         CPPUNIT_ASSERT(a2 != b2);
    65         CPPUNIT_ASSERT(!(a2 == b2));
    66         CPPUNIT_ASSERT(a2 != c2);
    67         CPPUNIT_ASSERT(!(a2 == c2));
     45        LOLUNIT_ASSERT(a2 == a2);
     46        LOLUNIT_ASSERT(!(a2 != a2));
     47
     48        LOLUNIT_ASSERT(a2 != b2);
     49        LOLUNIT_ASSERT(!(a2 == b2));
     50        LOLUNIT_ASSERT(a2 != c2);
     51        LOLUNIT_ASSERT(!(a2 == c2));
    6852
    6953        vec3 a3(1.0f, 2.0f, 3.0f);
     
    7256        vec3 d3(1.0f, 2.0f, 0.0f);
    7357
    74         CPPUNIT_ASSERT(a3 == a3);
    75         CPPUNIT_ASSERT(!(a3 != a3));
    76 
    77         CPPUNIT_ASSERT(a3 != b3);
    78         CPPUNIT_ASSERT(!(a3 == b3));
    79         CPPUNIT_ASSERT(a3 != c3);
    80         CPPUNIT_ASSERT(!(a3 == c3));
    81         CPPUNIT_ASSERT(a3 != d3);
    82         CPPUNIT_ASSERT(!(a3 == d3));
     58        LOLUNIT_ASSERT(a3 == a3);
     59        LOLUNIT_ASSERT(!(a3 != a3));
     60
     61        LOLUNIT_ASSERT(a3 != b3);
     62        LOLUNIT_ASSERT(!(a3 == b3));
     63        LOLUNIT_ASSERT(a3 != c3);
     64        LOLUNIT_ASSERT(!(a3 == c3));
     65        LOLUNIT_ASSERT(a3 != d3);
     66        LOLUNIT_ASSERT(!(a3 == d3));
    8367
    8468        vec4 a4(1.0f, 2.0f, 3.0f, 4.0f);
     
    8872        vec4 e4(1.0f, 2.0f, 3.0f, 0.0f);
    8973
    90         CPPUNIT_ASSERT(a4 == a4);
    91         CPPUNIT_ASSERT(!(a4 != a4));
    92 
    93         CPPUNIT_ASSERT(a4 != b4);
    94         CPPUNIT_ASSERT(!(a4 == b4));
    95         CPPUNIT_ASSERT(a4 != c4);
    96         CPPUNIT_ASSERT(!(a4 == c4));
    97         CPPUNIT_ASSERT(a4 != d4);
    98         CPPUNIT_ASSERT(!(a4 == d4));
    99         CPPUNIT_ASSERT(a4 != e4);
    100         CPPUNIT_ASSERT(!(a4 == e4));
    101     }
    102 
    103     void test_vec_lt()
     74        LOLUNIT_ASSERT(a4 == a4);
     75        LOLUNIT_ASSERT(!(a4 != a4));
     76
     77        LOLUNIT_ASSERT(a4 != b4);
     78        LOLUNIT_ASSERT(!(a4 == b4));
     79        LOLUNIT_ASSERT(a4 != c4);
     80        LOLUNIT_ASSERT(!(a4 == c4));
     81        LOLUNIT_ASSERT(a4 != d4);
     82        LOLUNIT_ASSERT(!(a4 == d4));
     83        LOLUNIT_ASSERT(a4 != e4);
     84        LOLUNIT_ASSERT(!(a4 == e4));
     85    }
     86
     87    LOLUNIT_TEST(test_vec_lt)
    10488    {
    10589        vec2 a2(1.0f, 3.0f);
     
    11094        vec2 f2(4.0f, 4.0f);
    11195
    112         CPPUNIT_ASSERT(a2 <= a2);
    113         CPPUNIT_ASSERT(!(a2 < a2));
    114 
    115         CPPUNIT_ASSERT(!(a2 <= b2));
    116         CPPUNIT_ASSERT(!(a2 < b2));
    117         CPPUNIT_ASSERT(!(a2 <= c2));
    118         CPPUNIT_ASSERT(!(a2 < c2));
    119         CPPUNIT_ASSERT(!(a2 <= d2));
    120         CPPUNIT_ASSERT(!(a2 < d2));
    121         CPPUNIT_ASSERT(a2 <= e2);
    122         CPPUNIT_ASSERT(!(a2 < e2));
    123         CPPUNIT_ASSERT(a2 <= f2);
    124         CPPUNIT_ASSERT(a2 < f2);
    125     }
    126 
    127     void test_vec_unary()
     96        LOLUNIT_ASSERT(a2 <= a2);
     97        LOLUNIT_ASSERT(!(a2 < a2));
     98
     99        LOLUNIT_ASSERT(!(a2 <= b2));
     100        LOLUNIT_ASSERT(!(a2 < b2));
     101        LOLUNIT_ASSERT(!(a2 <= c2));
     102        LOLUNIT_ASSERT(!(a2 < c2));
     103        LOLUNIT_ASSERT(!(a2 <= d2));
     104        LOLUNIT_ASSERT(!(a2 < d2));
     105        LOLUNIT_ASSERT(a2 <= e2);
     106        LOLUNIT_ASSERT(!(a2 < e2));
     107        LOLUNIT_ASSERT(a2 <= f2);
     108        LOLUNIT_ASSERT(a2 < f2);
     109    }
     110
     111    LOLUNIT_TEST(test_vec_unary)
    128112    {
    129113        vec2 a(1.0f, 3.0f);
    130114        vec2 b(-1.0f, -3.0f);
    131115
    132         CPPUNIT_ASSERT(a == -b);
    133         CPPUNIT_ASSERT(-a == b);
    134     }
    135 
    136     void test_vec_cast()
     116        LOLUNIT_ASSERT(a == -b);
     117        LOLUNIT_ASSERT(-a == b);
     118    }
     119
     120    LOLUNIT_TEST(test_vec_cast)
    137121    {
    138122        vec2 a1(1.0f, 3.0f);
     
    140124        vec3 b(a1);
    141125        vec2 a2(b);
    142         CPPUNIT_ASSERT_EQUAL(b.x, a1.x);
    143         CPPUNIT_ASSERT_EQUAL(b.y, a1.y);
    144         CPPUNIT_ASSERT_EQUAL(b.z, 0.0f);
    145         CPPUNIT_ASSERT(a2 == a1);
     126        LOLUNIT_ASSERT_EQUAL(b.x, a1.x);
     127        LOLUNIT_ASSERT_EQUAL(b.y, a1.y);
     128        LOLUNIT_ASSERT_EQUAL(b.z, 0.0f);
     129        LOLUNIT_ASSERT(a2 == a1);
    146130
    147131        vec4 c(a1);
    148132        vec2 a3(c);
    149         CPPUNIT_ASSERT_EQUAL(c.x, a1.x);
    150         CPPUNIT_ASSERT_EQUAL(c.y, a1.y);
    151         CPPUNIT_ASSERT_EQUAL(c.z, 0.0f);
    152         CPPUNIT_ASSERT_EQUAL(c.w, 0.0f);
    153         CPPUNIT_ASSERT(a3 == a1);
    154     }
    155 
    156     void test_mat_det()
     133        LOLUNIT_ASSERT_EQUAL(c.x, a1.x);
     134        LOLUNIT_ASSERT_EQUAL(c.y, a1.y);
     135        LOLUNIT_ASSERT_EQUAL(c.z, 0.0f);
     136        LOLUNIT_ASSERT_EQUAL(c.w, 0.0f);
     137        LOLUNIT_ASSERT(a3 == a1);
     138    }
     139
     140    LOLUNIT_TEST(test_mat_det)
    157141    {
    158142        float d1 = triangular.det();
    159         CPPUNIT_ASSERT_EQUAL(d1, 24.0f);
     143        LOLUNIT_ASSERT_EQUAL(d1, 24.0f);
    160144        float d2 = invertible.det();
    161         CPPUNIT_ASSERT_EQUAL(d2, -1.0f);
    162     }
    163 
    164     void test_mat_mul()
     145        LOLUNIT_ASSERT_EQUAL(d2, -1.0f);
     146    }
     147
     148    LOLUNIT_TEST(test_mat_mul)
    165149    {
    166150        mat4 m0 = identity;
     
    168152        mat4 m2 = m0 * m1;
    169153
    170         CPPUNIT_ASSERT_EQUAL(m2[0][0], 1.0f);
    171         CPPUNIT_ASSERT_EQUAL(m2[1][0], 0.0f);
    172         CPPUNIT_ASSERT_EQUAL(m2[2][0], 0.0f);
    173         CPPUNIT_ASSERT_EQUAL(m2[3][0], 0.0f);
    174 
    175         CPPUNIT_ASSERT_EQUAL(m2[0][1], 0.0f);
    176         CPPUNIT_ASSERT_EQUAL(m2[1][1], 1.0f);
    177         CPPUNIT_ASSERT_EQUAL(m2[2][1], 0.0f);
    178         CPPUNIT_ASSERT_EQUAL(m2[3][1], 0.0f);
    179 
    180         CPPUNIT_ASSERT_EQUAL(m2[0][2], 0.0f);
    181         CPPUNIT_ASSERT_EQUAL(m2[1][2], 0.0f);
    182         CPPUNIT_ASSERT_EQUAL(m2[2][2], 1.0f);
    183         CPPUNIT_ASSERT_EQUAL(m2[3][2], 0.0f);
    184 
    185         CPPUNIT_ASSERT_EQUAL(m2[0][3], 0.0f);
    186         CPPUNIT_ASSERT_EQUAL(m2[1][3], 0.0f);
    187         CPPUNIT_ASSERT_EQUAL(m2[2][3], 0.0f);
    188         CPPUNIT_ASSERT_EQUAL(m2[3][3], 1.0f);
    189     }
    190 
    191     void test_mat_inv()
     154        LOLUNIT_ASSERT_EQUAL(m2[0][0], 1.0f);
     155        LOLUNIT_ASSERT_EQUAL(m2[1][0], 0.0f);
     156        LOLUNIT_ASSERT_EQUAL(m2[2][0], 0.0f);
     157        LOLUNIT_ASSERT_EQUAL(m2[3][0], 0.0f);
     158
     159        LOLUNIT_ASSERT_EQUAL(m2[0][1], 0.0f);
     160        LOLUNIT_ASSERT_EQUAL(m2[1][1], 1.0f);
     161        LOLUNIT_ASSERT_EQUAL(m2[2][1], 0.0f);
     162        LOLUNIT_ASSERT_EQUAL(m2[3][1], 0.0f);
     163
     164        LOLUNIT_ASSERT_EQUAL(m2[0][2], 0.0f);
     165        LOLUNIT_ASSERT_EQUAL(m2[1][2], 0.0f);
     166        LOLUNIT_ASSERT_EQUAL(m2[2][2], 1.0f);
     167        LOLUNIT_ASSERT_EQUAL(m2[3][2], 0.0f);
     168
     169        LOLUNIT_ASSERT_EQUAL(m2[0][3], 0.0f);
     170        LOLUNIT_ASSERT_EQUAL(m2[1][3], 0.0f);
     171        LOLUNIT_ASSERT_EQUAL(m2[2][3], 0.0f);
     172        LOLUNIT_ASSERT_EQUAL(m2[3][3], 1.0f);
     173    }
     174
     175    LOLUNIT_TEST(test_mat_inv)
    192176    {
    193177        mat4 m0 = invertible;
     
    196180        mat4 m2 = m0 * m1;
    197181
    198         CPPUNIT_ASSERT_EQUAL(m2[0][0], 1.0f);
    199         CPPUNIT_ASSERT_EQUAL(m2[1][0], 0.0f);
    200         CPPUNIT_ASSERT_EQUAL(m2[2][0], 0.0f);
    201         CPPUNIT_ASSERT_EQUAL(m2[3][0], 0.0f);
    202 
    203         CPPUNIT_ASSERT_EQUAL(m2[0][1], 0.0f);
    204         CPPUNIT_ASSERT_EQUAL(m2[1][1], 1.0f);
    205         CPPUNIT_ASSERT_EQUAL(m2[2][1], 0.0f);
    206         CPPUNIT_ASSERT_EQUAL(m2[3][1], 0.0f);
    207 
    208         CPPUNIT_ASSERT_EQUAL(m2[0][2], 0.0f);
    209         CPPUNIT_ASSERT_EQUAL(m2[1][2], 0.0f);
    210         CPPUNIT_ASSERT_EQUAL(m2[2][2], 1.0f);
    211         CPPUNIT_ASSERT_EQUAL(m2[3][2], 0.0f);
    212 
    213         CPPUNIT_ASSERT_EQUAL(m2[0][3], 0.0f);
    214         CPPUNIT_ASSERT_EQUAL(m2[1][3], 0.0f);
    215         CPPUNIT_ASSERT_EQUAL(m2[2][3], 0.0f);
    216         CPPUNIT_ASSERT_EQUAL(m2[3][3], 1.0f);
     182        LOLUNIT_ASSERT_EQUAL(m2[0][0], 1.0f);
     183        LOLUNIT_ASSERT_EQUAL(m2[1][0], 0.0f);
     184        LOLUNIT_ASSERT_EQUAL(m2[2][0], 0.0f);
     185        LOLUNIT_ASSERT_EQUAL(m2[3][0], 0.0f);
     186
     187        LOLUNIT_ASSERT_EQUAL(m2[0][1], 0.0f);
     188        LOLUNIT_ASSERT_EQUAL(m2[1][1], 1.0f);
     189        LOLUNIT_ASSERT_EQUAL(m2[2][1], 0.0f);
     190        LOLUNIT_ASSERT_EQUAL(m2[3][1], 0.0f);
     191
     192        LOLUNIT_ASSERT_EQUAL(m2[0][2], 0.0f);
     193        LOLUNIT_ASSERT_EQUAL(m2[1][2], 0.0f);
     194        LOLUNIT_ASSERT_EQUAL(m2[2][2], 1.0f);
     195        LOLUNIT_ASSERT_EQUAL(m2[3][2], 0.0f);
     196
     197        LOLUNIT_ASSERT_EQUAL(m2[0][3], 0.0f);
     198        LOLUNIT_ASSERT_EQUAL(m2[1][3], 0.0f);
     199        LOLUNIT_ASSERT_EQUAL(m2[2][3], 0.0f);
     200        LOLUNIT_ASSERT_EQUAL(m2[3][3], 1.0f);
    217201    }
    218202
     
    221205};
    222206
    223 CPPUNIT_TEST_SUITE_REGISTRATION(MatrixTest);
     207LOLUNIT_SETUP_FIXTURE(MatrixTest);
    224208
    225209} /* namespace lol */
  • trunk/test/trig.cpp

    r911 r912  
    1313#endif
    1414
    15 #include <cppunit/extensions/HelperMacros.h>
    16 #include <cppunit/TestCaller.h>
    17 #include <cppunit/TestCase.h>
    18 #include <cppunit/TestSuite.h>
    19 
    2015#include <cmath>
    2116
    2217#include "core.h"
     18#include "lol/unit.h"
    2319
    2420namespace lol
    2521{
    2622
    27 class TrigTest : public CppUnit::TestCase
     23LOLUNIT_FIXTURE(TrigTest)
    2824{
    29     CPPUNIT_TEST_SUITE(TrigTest);
    30     CPPUNIT_TEST(test_sin);
    31     CPPUNIT_TEST_SUITE_END();
    32 
    3325public:
    34     TrigTest() : CppUnit::TestCase("Trigonometry Test") {}
    35 
    3626    void setUp() {}
    37 
    3827    void tearDown() {}
    3928
    40     void test_sin()
     29    LOLUNIT_TEST(test_sin)
    4130    {
    4231        for (int i = -10000; i < 10000; i++)
     
    4938#endif
    5039            double b = lol_sin(f);
    51             CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
     40            LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
    5241        }
    5342
     
    6150#endif
    6251            double b = lol_sin(f);
    63             CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
     52            LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
    6453        }
     54    }
    6555
     56    LOLUNIT_TEST(test_cos)
     57    {
    6658        for (int i = -10000; i < 10000; i++)
    6759        {
     
    7365#endif
    7466            double b = lol_cos(f);
    75             CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
     67            LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
    7668        }
    7769
     
    8577#endif
    8678            double b = lol_cos(f);
    87             CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
     79            LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
    8880        }
     81    }
    8982
     83    LOLUNIT_TEST(test_sincos)
     84    {
    9085        for (int i = -10000; i < 10000; i++)
    9186        {
     
    10095            double b1, b2;
    10196            lol_sincos(f, &b1, &b2);
    102             CPPUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, fabs(f) * 1e-11);
    103             CPPUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, fabs(f) * 1e-11);
     97            LOLUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, fabs(f) * 1e-11);
     98            LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, fabs(f) * 1e-11);
    10499        }
    105100
     
    116111            double b1, b2;
    117112            lol_sincos(f, &b1, &b2);
    118             CPPUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, fabs(f) * 1e-11);
    119             CPPUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, fabs(f) * 1e-11);
     113            LOLUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, fabs(f) * 1e-11);
     114            LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, fabs(f) * 1e-11);
    120115        }
     116    }
    121117
     118    LOLUNIT_TEST(test_tan)
     119    {
    122120        for (int i = -100000; i < 100000; i++)
    123121        {
     
    130128            double b = lol_tan(f);
    131129            if (fabs(a) > 1e4)
    132                 CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * fabs(a) * 1e-11);
     130                LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * fabs(a) * 1e-11);
    133131            else if (fabs(a) > 1.0)
    134                 CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * 1e-11);
     132                LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * 1e-11);
    135133            else
    136                 CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
     134                LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
    137135        }
    138136
     
    147145            double b = lol_tan(f);
    148146            if (fabs(a) > 1e4)
    149                 CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * fabs(a) * 1e-11);
     147                LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * fabs(a) * 1e-11);
    150148            else if (fabs(a) > 1.0)
    151                 CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * 1e-11);
     149                LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * 1e-11);
    152150            else
    153                 CPPUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
     151                LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11);
    154152        }
    155153    }
    156154};
    157155
    158 CPPUNIT_TEST_SUITE_REGISTRATION(TrigTest);
     156LOLUNIT_SETUP_FIXTURE(TrigTest);
    159157
    160158} /* namespace lol */
  • trunk/win32/Contribs.props

    r911 r912  
    44  <PropertyGroup Label="UserMacros">
    55    <ContribDir>$(SolutionDir)\..\contrib</ContribDir>
    6     <CppUnitDir>$(ContribDir)\cppunit-1.12.2</CppUnitDir>
    76    <GlewDir>$(ContribDir)\glew-1.6.0</GlewDir>
    87    <GtkDir>$(ContribDir)\gtk-2.22.1</GtkDir>
     
    1110    <SdlImageDir>$(ContribDir)\sdl-image-1.2.10</SdlImageDir>
    1211    <SdlMixerDir>$(ContribDir)\sdl-mixer-1.2.11</SdlMixerDir>
    13     <CppUnitIncludes>$(CppUnitDir)\include</CppUnitIncludes>
    1412    <GlIncludes>$(GlewDir)\include</GlIncludes>
    1513    <GtkIncludes>$(GtkDir)\lib\glib-2.0\include;$(GtkDir)\lib\gtk-2.0\include;$(GtkDir)\include\glib-2.0;$(GtkDir)\include\gtk-2.0;$(GtkDir)\include\cairo;$(GtkDir)\include\pango-1.0;$(GtkDir)\include\gdk-pixbuf-2.0;$(GtkDir)\include\atk-1.0;$(GtkGlDir)\include</GtkIncludes>
    1614    <SdlIncludes>$(SdlDir)\include;$(SdlImageDir)\include;$(SdlMixerDir)\include</SdlIncludes>
    17     <CppUnitLibs>$(CppUnitDir)\lib</CppUnitLibs>
    1815    <GlLibs>$(GlewDir)\lib</GlLibs>
    1916    <GtkLibs>$(GtkDir)\lib;$(GtkDir)\bin;$(GtkGlDir)\lib</GtkLibs>
     
    2825  <ItemGroup>
    2926    <BuildMacro Include="ContribDir"><Value>$(ContribDir)</Value></BuildMacro>
    30     <BuildMacro Include="CppUnitDir"><Value>$(CppUnitDir)</Value></BuildMacro>
    3127    <BuildMacro Include="GlewDir"><Value>$(GlewDir)</Value></BuildMacro>
    3228    <BuildMacro Include="GtkDir"><Value>$(GtkDir)</Value></BuildMacro>
     
    3531    <BuildMacro Include="SdlImageDir"><Value>$(SdlImageDir)</Value></BuildMacro>
    3632    <BuildMacro Include="SdlMixerDir"><Value>$(SdlMixerDir)</Value></BuildMacro>
    37     <BuildMacro Include="CppUnitIncludes"><Value>$(CppUnitIncludes)</Value></BuildMacro>
    3833    <BuildMacro Include="GlIncludes"><Value>$(GlIncludes)</Value></BuildMacro>
    3934    <BuildMacro Include="GtkIncludes"><Value>$(GtkIncludes)</Value></BuildMacro>
    4035    <BuildMacro Include="SdlIncludes"><Value>$(SdlIncludes)</Value></BuildMacro>
    41     <BuildMacro Include="CppUnitLibss"><Value>$(CppUnitLibss)</Value></BuildMacro>
    4236    <BuildMacro Include="GlLibs"><Value>$(GlLibs)</Value></BuildMacro>
    4337    <BuildMacro Include="GtkLibs"><Value>$(GtkLibs)</Value></BuildMacro>
  • trunk/win32/lol-test.vcxproj

    r911 r912  
    6363      <Optimization>Disabled</Optimization>
    6464      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;$(LolDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    65       <AdditionalIncludeDirectories>$(SolutionDir)\..\src;$(CppUnitIncludes);$(GlIncludes);$(SdlIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     65      <AdditionalIncludeDirectories>$(SolutionDir)\..\src;$(GlIncludes);$(SdlIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    6666    </ClCompile>
    6767    <Link>
    6868      <SubSystem>Console</SubSystem>
    6969      <GenerateDebugInformation>true</GenerateDebugInformation>
    70       <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(SdlDeps);libcppunit_msvcd.lib;$(GlDeps);$(OutDir)\lolcore.lib</AdditionalDependencies>
    71       <AdditionalLibraryDirectories>$(SdlLibs);$(CppUnitLibs);$(GlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     70      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(SdlDeps);$(GlDeps);$(OutDir)\lolcore.lib</AdditionalDependencies>
     71      <AdditionalLibraryDirectories>$(SdlLibs);$(GlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
    7272    </Link>
    7373    <PostBuildEvent>
     
    8484      <IntrinsicFunctions>true</IntrinsicFunctions>
    8585      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;$(LolDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    86       <AdditionalIncludeDirectories>$(SolutionDir)\..\src;$(CppUnitIncludes);$(GlIncludes);$(SdlIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     86      <AdditionalIncludeDirectories>$(SolutionDir)\..\src;$(GlIncludes);$(SdlIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    8787    </ClCompile>
    8888    <Link>
     
    9191      <EnableCOMDATFolding>true</EnableCOMDATFolding>
    9292      <OptimizeReferences>true</OptimizeReferences>
    93       <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(SdlDeps);libcppunit_msvc.lib;$(GlDeps);$(OutDir)\lolcore.lib</AdditionalDependencies>
    94       <AdditionalLibraryDirectories>$(SdlLibs);$(CppUnitLibs);$(GlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     93      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(SdlDeps);$(GlDeps);$(OutDir)\lolcore.lib</AdditionalDependencies>
     94      <AdditionalLibraryDirectories>$(SdlLibs);$(GlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
    9595    </Link>
    9696    <PostBuildEvent>
Note: See TracChangeset for help on using the changeset viewer.