Changeset 976 for trunk/test/unit


Ignore:
Timestamp:
Sep 22, 2011, 6:16:51 PM (11 years ago)
Author:
sam
Message:

core: allow to cast reals to doubles in addition to floats.

File:
1 edited

Legend:

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

    r975 r976  
    3030        float a4 = real(-1.0f);
    3131        float a5 = real(1.5f);
     32        float a6 = real(12345678.0f);
    3233
    3334        LOLUNIT_ASSERT_EQUAL(a1, 0.0f);
     
    3637        LOLUNIT_ASSERT_EQUAL(a4, -1.0f);
    3738        LOLUNIT_ASSERT_EQUAL(a5, 1.5f);
     39        LOLUNIT_ASSERT_EQUAL(a6, 12345678.0f);
     40    }
     41
     42    LOLUNIT_TEST(test_real_from_double)
     43    {
     44        double a1 = real(0.0);
     45        double a2 = real(-0.0);
     46        double a3 = real(1.0);
     47        double a4 = real(-1.0);
     48        double a5 = real(1.5);
     49        double a6 = real(1234567876543210.0);
     50
     51        LOLUNIT_ASSERT_DOUBLES_EQUAL(a1, 0.0, 0.0);
     52        LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, -0.0, 0.0);
     53        LOLUNIT_ASSERT_DOUBLES_EQUAL(a3, 1.0, 0.0);
     54        LOLUNIT_ASSERT_DOUBLES_EQUAL(a4, -1.0, 0.0);
     55        LOLUNIT_ASSERT_DOUBLES_EQUAL(a5, 1.5, 0.0);
     56        LOLUNIT_ASSERT_DOUBLES_EQUAL(a6, 1234567876543210.0, 0.0);
    3857    }
    3958
Note: See TracChangeset for help on using the changeset viewer.