Changeset 1668


Ignore:
Timestamp:
Jul 26, 2012, 8:22:38 AM (8 years ago)
Author:
sam
Message:

test: add a unit test to ensure default constructed reals are initialised
to zero.

File:
1 edited

Legend:

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

    r1130 r1668  
    102102        LOLUNIT_ASSERT_DOUBLES_EQUAL(a5, 1.5, 0.0);
    103103        LOLUNIT_ASSERT_DOUBLES_EQUAL(a6, 1234567876543210.0, 0.0);
     104    }
     105
     106    LOLUNIT_TEST(Init)
     107    {
     108        real r;
     109        float f1 = (float)r;
     110
     111        LOLUNIT_ASSERT_EQUAL(f1, 0.0f);
     112
     113        rcmplx q;
     114        float f2 = (float)q.x;
     115        float f3 = (float)q.y;
     116
     117        LOLUNIT_ASSERT_EQUAL(f2, 0.0f);
     118        LOLUNIT_ASSERT_EQUAL(f3, 0.0f);
    104119    }
    105120
Note: See TracChangeset for help on using the changeset viewer.