Changeset 972 for trunk/test/unit


Ignore:
Timestamp:
Sep 22, 2011, 9:15:59 AM (11 years ago)
Author:
sam
Message:

core: fix real unary minus and handle negative numbers in additions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/real.cpp

    r971 r972  
    2323LOLUNIT_FIXTURE(RealTest)
    2424{
    25 public:
    2625    LOLUNIT_TEST(test_real_from_float)
    2726    {
     
    5453    LOLUNIT_TEST(test_real_add)
    5554    {
     55        float a1 = real(1.0f) + real(0.0f);
     56        float a2 = real(0.0f) + real(1.0f);
     57        float a3 = real(1.0f) + real(1.0f);
     58        float a4 = real(-1.0f) + real(-1.0f);
     59        float a5 = real(1.0f) + real(0.125f);
     60
     61        LOLUNIT_ASSERT_EQUAL(a1, 1.0f);
     62        LOLUNIT_ASSERT_EQUAL(a2, 1.0f);
     63        LOLUNIT_ASSERT_EQUAL(a3, 2.0f);
     64        LOLUNIT_ASSERT_EQUAL(a4, -2.0f);
     65        LOLUNIT_ASSERT_EQUAL(a5, 1.125f);
     66    }
     67
     68    LOLUNIT_TEST(test_real_sub)
     69    {
     70#if 0
     71printf("\n");
     72real k(1.25f);
     73k.print();
     74real l(1.0f);
     75l.print();
     76real m = k - l;
     77m.print();
     78#endif
    5679        LOLUNIT_ASSERT(true);
    5780    }
Note: See TracChangeset for help on using the changeset viewer.