Changeset 1321


Ignore:
Timestamp:
Apr 30, 2012, 8:40:56 PM (10 years ago)
Author:
sam
Message:

test: add matrix determinant and quaternion norm checks in the unit tests.

File:
1 edited

Legend:

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

    r1320 r1321  
    3535        LOLUNIT_ASSERT_DOUBLES_EQUAL(b.x, -a.y, 1e-5);
    3636        LOLUNIT_ASSERT_DOUBLES_EQUAL(b.y,  a.x, 1e-5);
     37
     38        float d = determinant(m90);
     39
     40        LOLUNIT_ASSERT_DOUBLES_EQUAL(d, 1.0, 1e-5);
    3741    }
    3842
     
    7478        LOLUNIT_ASSERT_DOUBLES_EQUAL(d.y,  a.x, 1e-5);
    7579        LOLUNIT_ASSERT_DOUBLES_EQUAL(d.z,  a.z, 1e-5);
     80
     81        float dx = determinant(m90x);
     82        float dy = determinant(m90y);
     83        float dz = determinant(m90z);
     84
     85        LOLUNIT_ASSERT_DOUBLES_EQUAL(dx, 1.0, 1e-5);
     86        LOLUNIT_ASSERT_DOUBLES_EQUAL(dy, 1.0, 1e-5);
     87        LOLUNIT_ASSERT_DOUBLES_EQUAL(dz, 1.0, 1e-5);
    7688    }
    7789
     
    109121        LOLUNIT_ASSERT_DOUBLES_EQUAL(c.y, b.y, 1e-5);
    110122        LOLUNIT_ASSERT_DOUBLES_EQUAL(c.z, b.z, 1e-5);
     123
     124        float n = norm(q20);
     125
     126        LOLUNIT_ASSERT_DOUBLES_EQUAL(n, 1.0, 1e-5);
    111127    }
    112128
     
    122138        LOLUNIT_ASSERT_DOUBLES_EQUAL(q2.y, q1.y, 1e-5);
    123139        LOLUNIT_ASSERT_DOUBLES_EQUAL(q2.z, q1.z, 1e-5);
     140
     141        float n1 = norm(q1);
     142        float n2 = norm(q2);
     143
     144        LOLUNIT_ASSERT_DOUBLES_EQUAL(n1, 1.0, 1e-5);
     145        LOLUNIT_ASSERT_DOUBLES_EQUAL(n2, 1.0, 1e-5);
    124146    }
    125147
     
    142164        LOLUNIT_ASSERT_DOUBLES_EQUAL(m2[1][2], m1[1][2], 1e-5);
    143165        LOLUNIT_ASSERT_DOUBLES_EQUAL(m2[2][2], m1[2][2], 1e-5);
     166
     167        float d1 = determinant(m1);
     168        float d2 = determinant(m2);
     169
     170        LOLUNIT_ASSERT_DOUBLES_EQUAL(d1, 1.0, 1e-5);
     171        LOLUNIT_ASSERT_DOUBLES_EQUAL(d2, 1.0, 1e-5);
    144172    }
    145173
Note: See TracChangeset for help on using the changeset viewer.