| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,25 +17,21 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| struct TrackedObj | |||||
| struct tracked_object | |||||
| { | { | ||||
| static int m_ctor, m_dtor; | static int m_ctor, m_dtor; | ||||
| TrackedObj() { m_ctor++; } | |||||
| TrackedObj(TrackedObj const &) { m_ctor++; } | |||||
| ~TrackedObj() { m_dtor++; } | |||||
| tracked_object() { m_ctor++; } | |||||
| tracked_object(tracked_object const &) { m_ctor++; } | |||||
| ~tracked_object() { m_dtor++; } | |||||
| }; | }; | ||||
| int TrackedObj::m_ctor = 0; | |||||
| int TrackedObj::m_dtor = 0; | |||||
| int tracked_object::m_ctor = 0; | |||||
| int tracked_object::m_dtor = 0; | |||||
| lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_declare_fixture(array_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(ArrayPush) | |||||
| lolunit_declare_test(array_push) | |||||
| { | { | ||||
| array<int> a; | array<int> a; | ||||
| a.push(0); | a.push(0); | ||||
| @@ -49,7 +45,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(a[3], 3); | lolunit_assert_equal(a[3], 3); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayInitializer) | |||||
| lolunit_declare_test(array_initializer) | |||||
| { | { | ||||
| array<int> a({ 2, 4, 6 }); | array<int> a({ 2, 4, 6 }); | ||||
| @@ -75,7 +71,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(c[2].m2, 7.0f); | lolunit_assert_equal(c[2].m2, 7.0f); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayPushWithShift) | |||||
| lolunit_declare_test(array_push_with_shift) | |||||
| { | { | ||||
| array<int> a; | array<int> a; | ||||
| a << 0 << 1 << 2 << 3; | a << 0 << 1 << 2 << 3; | ||||
| @@ -86,7 +82,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(a[3], 3); | lolunit_assert_equal(a[3], 3); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayCopy) | |||||
| lolunit_declare_test(array_copy) | |||||
| { | { | ||||
| array<int> a; | array<int> a; | ||||
| a << 0 << 1 << 2 << 3; | a << 0 << 1 << 2 << 3; | ||||
| @@ -99,7 +95,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(b[3], 3); | lolunit_assert_equal(b[3], 3); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayRemove) | |||||
| lolunit_declare_test(array_remove) | |||||
| { | { | ||||
| array<int> a; | array<int> a; | ||||
| a << 0 << 1 << 2 << 3; | a << 0 << 1 << 2 << 3; | ||||
| @@ -120,7 +116,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(b[2], 3); | lolunit_assert_equal(b[2], 3); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayRemoveSwap) | |||||
| lolunit_declare_test(array_remove_swap) | |||||
| { | { | ||||
| array<int> a; | array<int> a; | ||||
| a << 0 << 1 << 2 << 3; | a << 0 << 1 << 2 << 3; | ||||
| @@ -140,7 +136,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(b[1], 3); | lolunit_assert_equal(b[1], 3); | ||||
| } | } | ||||
| lolunit_declare_test(EightElements) | |||||
| lolunit_declare_test(eight_element_arrays) | |||||
| { | { | ||||
| array<int, long, float, double, unsigned, char, bool, void *> a; | array<int, long, float, double, unsigned, char, bool, void *> a; | ||||
| a.push(1, 2, 3.f, 4.0, 5, 'a', true, 0); | a.push(1, 2, 3.f, 4.0, 5, 'a', true, 0); | ||||
| @@ -155,7 +151,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(a[0].m8, 0); | lolunit_assert_equal(a[0].m8, 0); | ||||
| } | } | ||||
| lolunit_declare_test(ArraySwap) | |||||
| lolunit_declare_test(array_swap) | |||||
| { | { | ||||
| array<int, int> a; | array<int, int> a; | ||||
| a.push(10, 20); | a.push(10, 20); | ||||
| @@ -169,7 +165,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(20, a[1].m2); | lolunit_assert_equal(20, a[1].m2); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayInsert) | |||||
| lolunit_declare_test(array_insert) | |||||
| { | { | ||||
| array<int> a; | array<int> a; | ||||
| a << 1 << 2; | a << 1 << 2; | ||||
| @@ -193,7 +189,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(6, a[4]); | lolunit_assert_equal(6, a[4]); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayInsertTuple) | |||||
| lolunit_declare_test(array_insert_tuple) | |||||
| { | { | ||||
| array<int, float, String> b; | array<int, float, String> b; | ||||
| b.insert(0, 5, 6.f, "lol"); | b.insert(0, 5, 6.f, "lol"); | ||||
| @@ -215,7 +211,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(9.f, b[2].m2); | lolunit_assert_equal(9.f, b[2].m2); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayConcat) | |||||
| lolunit_declare_test(array_concat) | |||||
| { | { | ||||
| array<int> a, b; | array<int> a, b; | ||||
| a << 0 << 1; | a << 0 << 1; | ||||
| @@ -228,7 +224,7 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(c[3], 3); | lolunit_assert_equal(c[3], 3); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayAppend) | |||||
| lolunit_declare_test(array_append) | |||||
| { | { | ||||
| array<int> a, b; | array<int> a, b; | ||||
| a << 0 << 1; | a << 0 << 1; | ||||
| @@ -247,29 +243,29 @@ lolunit_declare_fixture(ArrayTest) | |||||
| lolunit_assert_equal(b[3], 3); | lolunit_assert_equal(b[3], 3); | ||||
| } | } | ||||
| lolunit_declare_test(ElementCtorDtor) | |||||
| lolunit_declare_test(element_ctor_dtor) | |||||
| { | { | ||||
| /* Ensure array elements get created and destroyed the proper | /* Ensure array elements get created and destroyed the proper | ||||
| * number of times. */ | * number of times. */ | ||||
| TrackedObj::m_ctor = 0; | |||||
| TrackedObj::m_dtor = 0; | |||||
| tracked_object::m_ctor = 0; | |||||
| tracked_object::m_dtor = 0; | |||||
| { | { | ||||
| array<TrackedObj> a; | |||||
| array<tracked_object> a; | |||||
| a.push(TrackedObj()); | |||||
| a.push(tracked_object()); | |||||
| } | } | ||||
| lolunit_assert_equal(TrackedObj::m_ctor, TrackedObj::m_dtor); | |||||
| lolunit_assert_equal(tracked_object::m_ctor, tracked_object::m_dtor); | |||||
| TrackedObj::m_ctor = 0; | |||||
| TrackedObj::m_dtor = 0; | |||||
| tracked_object::m_ctor = 0; | |||||
| tracked_object::m_dtor = 0; | |||||
| { | { | ||||
| array<TrackedObj> a; | |||||
| array<tracked_object> a; | |||||
| a.resize(2); | a.resize(2); | ||||
| a.resize(4); | a.resize(4); | ||||
| a.resize(1); | a.resize(1); | ||||
| } | } | ||||
| lolunit_assert_equal(TrackedObj::m_ctor, TrackedObj::m_dtor); | |||||
| lolunit_assert_equal(tracked_object::m_ctor, tracked_object::m_dtor); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -32,10 +32,6 @@ public: | |||||
| lolunit_declare_fixture(avl_tree_test) | lolunit_declare_fixture(avl_tree_test) | ||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(insert) | lolunit_declare_test(insert) | ||||
| { | { | ||||
| test_tree tree; | test_tree tree; | ||||
| @@ -118,7 +114,7 @@ lolunit_declare_fixture(avl_tree_test) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(AvlTreeExistence) | |||||
| lolunit_declare_test(avl_tree_existence) | |||||
| { | { | ||||
| test_tree tree; | test_tree tree; | ||||
| @@ -150,7 +146,7 @@ lolunit_declare_fixture(avl_tree_test) | |||||
| } | } | ||||
| lolunit_declare_test(AvlTreeGetValue) | |||||
| lolunit_declare_test(avl_tree_get_value) | |||||
| { | { | ||||
| test_tree tree; | test_tree tree; | ||||
| @@ -196,7 +192,7 @@ lolunit_declare_fixture(avl_tree_test) | |||||
| lolunit_assert_equal(*value_ptr, 3); | lolunit_assert_equal(*value_ptr, 3); | ||||
| } | } | ||||
| lolunit_declare_test(AvlTreeTestIteratorRead) | |||||
| lolunit_declare_test(avl_tree_test_iterator_read) | |||||
| { | { | ||||
| test_tree tree; | test_tree tree; | ||||
| @@ -215,7 +211,7 @@ lolunit_declare_fixture(avl_tree_test) | |||||
| lolunit_assert_equal(tree.count(), 99); | lolunit_assert_equal(tree.count(), 99); | ||||
| } | } | ||||
| lolunit_declare_test(AvlTreeTestIteratorCopy) | |||||
| lolunit_declare_test(avl_tree_test_iterator_copy) | |||||
| { | { | ||||
| test_tree tree; | test_tree tree; | ||||
| @@ -236,7 +232,7 @@ lolunit_declare_fixture(avl_tree_test) | |||||
| lolunit_assert_equal(other.count(), 99); | lolunit_assert_equal(other.count(), 99); | ||||
| } | } | ||||
| lolunit_declare_test(AvlTreeTestCopy) | |||||
| lolunit_declare_test(avl_tree_test_copy) | |||||
| { | { | ||||
| avl_tree<int, int> test1, test2; | avl_tree<int, int> test1, test2; | ||||
| @@ -17,46 +17,43 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(EnumTest) | |||||
| lolunit_declare_fixture(enum_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(EnumToString) | |||||
| lolunit_declare_test(enum_to_string) | |||||
| { | { | ||||
| struct MyEnumBase : public StructSafeEnum | |||||
| struct my_enum_base : public StructSafeEnum | |||||
| { | { | ||||
| enum Type | enum Type | ||||
| { | { | ||||
| First = -10, | |||||
| Second, | |||||
| Third = 5, | |||||
| first = -10, | |||||
| second, | |||||
| third = 5, | |||||
| }; | }; | ||||
| protected: | protected: | ||||
| virtual bool BuildEnumMap(map<int64_t, String>& enum_map) | virtual bool BuildEnumMap(map<int64_t, String>& enum_map) | ||||
| { | { | ||||
| enum_map[First] = "First"; | |||||
| enum_map[Second] = "Second"; | |||||
| enum_map[Third] = "Third"; | |||||
| enum_map[first] = "first"; | |||||
| enum_map[second] = "second"; | |||||
| enum_map[third] = "third"; | |||||
| return true; | return true; | ||||
| } | } | ||||
| }; | }; | ||||
| typedef SafeEnum<MyEnumBase> MyEnum; | |||||
| typedef SafeEnum<my_enum_base> my_enum; | |||||
| MyEnum e = MyEnum::First; | |||||
| lolunit_assert(e.ToString() == "First"); | |||||
| my_enum e = my_enum::first; | |||||
| lolunit_assert(e.ToString() == "first"); | |||||
| e = MyEnum::Second; | |||||
| lolunit_assert(e.ToString() == "Second"); | |||||
| e = my_enum::second; | |||||
| lolunit_assert(e.ToString() == "second"); | |||||
| e = MyEnum::Third; | |||||
| lolunit_assert(e.ToString() == "Third"); | |||||
| e = my_enum::third; | |||||
| lolunit_assert(e.ToString() == "third"); | |||||
| e = MyEnum(42); | |||||
| lolunit_assert(e.ToString() != "First"); | |||||
| lolunit_assert(e.ToString() != "Second"); | |||||
| lolunit_assert(e.ToString() != "Third"); | |||||
| e = my_enum(42); | |||||
| lolunit_assert(e.ToString() != "first"); | |||||
| lolunit_assert(e.ToString() != "second"); | |||||
| lolunit_assert(e.ToString() != "third"); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -17,13 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(MapTest) | |||||
| lolunit_declare_fixture(map_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(MapDeclare) | |||||
| lolunit_declare_test(map_declare) | |||||
| { | { | ||||
| map<uint8_t, uint8_t> m1; | map<uint8_t, uint8_t> m1; | ||||
| map<int, int> m2; | map<int, int> m2; | ||||
| @@ -31,7 +27,7 @@ lolunit_declare_fixture(MapTest) | |||||
| map<char const *, char const *> m4; | map<char const *, char const *> m4; | ||||
| } | } | ||||
| lolunit_declare_test(MapSet) | |||||
| lolunit_declare_test(map_set) | |||||
| { | { | ||||
| map<int, int> m; | map<int, int> m; | ||||
| @@ -45,7 +41,7 @@ lolunit_declare_fixture(MapTest) | |||||
| lolunit_assert_equal(m[i], i); | lolunit_assert_equal(m[i], i); | ||||
| } | } | ||||
| lolunit_declare_test(MapHasKey) | |||||
| lolunit_declare_test(map_has_key) | |||||
| { | { | ||||
| map<int, int> m; | map<int, int> m; | ||||
| @@ -57,7 +53,7 @@ lolunit_declare_fixture(MapTest) | |||||
| lolunit_assert(m.has_key(2)); | lolunit_assert(m.has_key(2)); | ||||
| } | } | ||||
| lolunit_declare_test(MapRemove) | |||||
| lolunit_declare_test(map_remove) | |||||
| { | { | ||||
| map<uint64_t, uint64_t> m; | map<uint64_t, uint64_t> m; | ||||
| array<uint64_t> a; | array<uint64_t> a; | ||||
| @@ -74,7 +70,7 @@ lolunit_declare_fixture(MapTest) | |||||
| m.remove(a[i]); | m.remove(a[i]); | ||||
| } | } | ||||
| lolunit_declare_test(MapRemoveString) | |||||
| lolunit_declare_test(map_remove_string) | |||||
| { | { | ||||
| map<String, uint64_t> m; | map<String, uint64_t> m; | ||||
| array<String> a; | array<String> a; | ||||
| @@ -91,7 +87,7 @@ lolunit_declare_fixture(MapTest) | |||||
| m.remove(a[i]); | m.remove(a[i]); | ||||
| } | } | ||||
| lolunit_declare_test(MapRemoveBug) | |||||
| lolunit_declare_test(map_remove_bug) | |||||
| { | { | ||||
| map<uint64_t, uint64_t> m; | map<uint64_t, uint64_t> m; | ||||
| @@ -104,7 +100,7 @@ lolunit_declare_fixture(MapTest) | |||||
| lolunit_assert_equal(m[8], 8); | lolunit_assert_equal(m[8], 8); | ||||
| } | } | ||||
| lolunit_declare_test(MapRandomAddRemove) | |||||
| lolunit_declare_test(map_random_add_remove) | |||||
| { | { | ||||
| map<unsigned char, unsigned char> m; | map<unsigned char, unsigned char> m; | ||||
| @@ -147,7 +143,7 @@ lolunit_declare_fixture(MapTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(StringMap) | |||||
| lolunit_declare_test(string_map) | |||||
| { | { | ||||
| map<char const *, int> m; | map<char const *, int> m; | ||||
| @@ -164,124 +160,127 @@ lolunit_declare_fixture(MapTest) | |||||
| lolunit_assert_equal(2, baz); | lolunit_assert_equal(2, baz); | ||||
| //Big stress test | //Big stress test | ||||
| array<String> bones = { "RootNode", | |||||
| "Cyberano_Ns:Root_$AssimpFbx$_Translation", | |||||
| "Cyberano_Ns:Box004_$AssimpFbx$_PreRotation", | |||||
| "Cyberano_Ns:Root_$AssimpFbx$_PreRotation", | |||||
| "Cyberano_Ns:Box004", | |||||
| "Cyberano_Ns:Root_$AssimpFbx$_Rotation", | |||||
| "Cyberano_Ns:Root", | |||||
| "Cyberano_Ns:Hips", | |||||
| "Cyberano_Ns:Spine", | |||||
| "Cyberano_Ns:RightUpLeg", | |||||
| "Cyberano_Ns:LeftUpLeg", | |||||
| "Cyberano_Ns:BeltSheath1", | |||||
| "Cyberano_Ns:RightCoat", | |||||
| "Cyberano_Ns:LeftCoat", | |||||
| "Cyberano_Ns:Spine1", | |||||
| "Cyberano_Ns:RightLeg", | |||||
| "Cyberano_Ns:RightUpLegRoll", | |||||
| "Cyberano_Ns:LeftUpLegRoll", | |||||
| "Cyberano_Ns:LeftLeg", | |||||
| "Cyberano_Ns:Sheath", | |||||
| "Cyberano_Ns:BeltSheath2", | |||||
| "Cyberano_Ns:BeltSheath3", | |||||
| "Cyberano_Ns:Spine2", | |||||
| "Cyberano_Ns:FrontBelt1", | |||||
| "Cyberano_Ns:BackBelt1", | |||||
| "Cyberano_Ns:RightFoot", | |||||
| "Cyberano_Ns:RightLegRoll", | |||||
| "Cyberano_Ns:LeftLegRoll", | |||||
| "Cyberano_Ns:LeftFoot", | |||||
| "Cyberano_Ns:Sword", | |||||
| "Cyberano_Ns:Neck", | |||||
| "Cyberano_Ns:RightShoulder", | |||||
| "Cyberano_Ns:LeftShoulder", | |||||
| "Cyberano_Ns:Cloth", | |||||
| "Cyberano_Ns:FrontBelt2", | |||||
| "Cyberano_Ns:RightToeBase", | |||||
| "Cyberano_Ns:LeftToeBase", | |||||
| "Cyberano_Ns:Head", | |||||
| "Cyberano_Ns:RightArm", | |||||
| "Cyberano_Ns:RightSpaulder1", | |||||
| "Cyberano_Ns:RightSpaulder2", | |||||
| "Cyberano_Ns:LeftArm", | |||||
| "Cyberano_Ns:LeftSpaulder1", | |||||
| "Cyberano_Ns:LeftCloth01", | |||||
| "Cyberano_Ns:MiddleCloth01", | |||||
| "Cyberano_Ns:RightCloth01", | |||||
| "Cyberano_Ns:FrontBelt3", | |||||
| "Cyberano_Ns:RightoeEnd", | |||||
| "Cyberano_Ns:LeftoeEnd", | |||||
| "Cyberano_Ns:HeadEnd", | |||||
| "Cyberano_Ns:Cap", | |||||
| "Cyberano_Ns:RightForeArm", | |||||
| "Cyberano_Ns:RightArmRoll", | |||||
| "Cyberano_Ns:LeftForeArm", | |||||
| "Cyberano_Ns:LeftArmRoll", | |||||
| "Cyberano_Ns:LeftCloth02", | |||||
| "Cyberano_Ns:MiddleCloth02", | |||||
| "Cyberano_Ns:RightCloth02", | |||||
| "Cyberano_Ns:Feather01", | |||||
| "Cyberano_Ns:RightHand", | |||||
| "Cyberano_Ns:RightForeArmRoll", | |||||
| "Cyberano_Ns:LeftHand", | |||||
| "Cyberano_Ns:LeftForeArmRoll", | |||||
| "Cyberano_Ns:LeftCloth03", | |||||
| "Cyberano_Ns:MiddleCloth03", | |||||
| "Cyberano_Ns:RightCloth03", | |||||
| "Cyberano_Ns:Feather02", | |||||
| "Cyberano_Ns:RightThumb1", | |||||
| "Cyberano_Ns:RightIndex1", | |||||
| "Cyberano_Ns:RightMiddle1", | |||||
| "Cyberano_Ns:RightRing1", | |||||
| "Cyberano_Ns:RightCuff", | |||||
| "Cyberano_Ns:LeftThumb1", | |||||
| "Cyberano_Ns:LeftIndex1", | |||||
| "Cyberano_Ns:LeftMiddle1", | |||||
| "Cyberano_Ns:LeftRing1", | |||||
| "Cyberano_Ns:LeftCloth04", | |||||
| "Cyberano_Ns:MiddleCloth04", | |||||
| "Cyberano_Ns:RightCloth04", | |||||
| "Cyberano_Ns:Feather03", | |||||
| "Cyberano_Ns:RightThumb2", | |||||
| "Cyberano_Ns:RightIndex2", | |||||
| "Cyberano_Ns:RightMiddle2", | |||||
| "Cyberano_Ns:RightRing2", | |||||
| "Cyberano_Ns:LeftThumb2", | |||||
| "Cyberano_Ns:LeftIndex2", | |||||
| "Cyberano_Ns:LeftMiddle2", | |||||
| "Cyberano_Ns:LeftRing2", | |||||
| "Cyberano_Ns:Feather04", | |||||
| "Cyberano_Ns:RightThumb3", | |||||
| "Cyberano_Ns:RightIndex3", | |||||
| "Cyberano_Ns:RightMiddle3", | |||||
| "Cyberano_Ns:RightRing3", | |||||
| "Cyberano_Ns:LeftThumb3", | |||||
| "Cyberano_Ns:LeftIndex3", | |||||
| "Cyberano_Ns:LeftMiddle3", | |||||
| "Cyberano_Ns:LeftRing3", | |||||
| "Cyberano_Ns:Feather05", | |||||
| "Cyberano_Ns:RightThumb4", | |||||
| "Cyberano_Ns:RightIndex4", | |||||
| "Cyberano_Ns:RightMiddle4", | |||||
| "Cyberano_Ns:RightRing4", | |||||
| "Cyberano_Ns:LeftThumb4", | |||||
| "Cyberano_Ns:LeftIndex4", | |||||
| "Cyberano_Ns:LeftMiddle4", | |||||
| "Cyberano_Ns:LeftRing4", | |||||
| "Cyberano_Ns:Feather06", | |||||
| "Cyberano_Ns:Feather07", | |||||
| "Cyberano_Ns:Feather08", | |||||
| "Cyberano_Ns:Feather09", | |||||
| "Cyberano_Ns:Feather10", | |||||
| "Cyberano_Ns:Feather11", | |||||
| "Cyberano_Ns:Feather12", | |||||
| "Cyberano_Ns:Feather13", | |||||
| "Cyberano_Ns:Feather14", | |||||
| "Cyberano_Ns:Feather15", | |||||
| "Cyberano_Ns:Feather16", | |||||
| "Cyberano_Ns:Feather17" }; | |||||
| array<String> bones = | |||||
| { | |||||
| "RootNode", | |||||
| "Cyberano_Ns:Root_$AssimpFbx$_Translation", | |||||
| "Cyberano_Ns:Box004_$AssimpFbx$_PreRotation", | |||||
| "Cyberano_Ns:Root_$AssimpFbx$_PreRotation", | |||||
| "Cyberano_Ns:Box004", | |||||
| "Cyberano_Ns:Root_$AssimpFbx$_Rotation", | |||||
| "Cyberano_Ns:Root", | |||||
| "Cyberano_Ns:Hips", | |||||
| "Cyberano_Ns:Spine", | |||||
| "Cyberano_Ns:RightUpLeg", | |||||
| "Cyberano_Ns:LeftUpLeg", | |||||
| "Cyberano_Ns:BeltSheath1", | |||||
| "Cyberano_Ns:RightCoat", | |||||
| "Cyberano_Ns:LeftCoat", | |||||
| "Cyberano_Ns:Spine1", | |||||
| "Cyberano_Ns:RightLeg", | |||||
| "Cyberano_Ns:RightUpLegRoll", | |||||
| "Cyberano_Ns:LeftUpLegRoll", | |||||
| "Cyberano_Ns:LeftLeg", | |||||
| "Cyberano_Ns:Sheath", | |||||
| "Cyberano_Ns:BeltSheath2", | |||||
| "Cyberano_Ns:BeltSheath3", | |||||
| "Cyberano_Ns:Spine2", | |||||
| "Cyberano_Ns:FrontBelt1", | |||||
| "Cyberano_Ns:BackBelt1", | |||||
| "Cyberano_Ns:RightFoot", | |||||
| "Cyberano_Ns:RightLegRoll", | |||||
| "Cyberano_Ns:LeftLegRoll", | |||||
| "Cyberano_Ns:LeftFoot", | |||||
| "Cyberano_Ns:Sword", | |||||
| "Cyberano_Ns:Neck", | |||||
| "Cyberano_Ns:RightShoulder", | |||||
| "Cyberano_Ns:LeftShoulder", | |||||
| "Cyberano_Ns:Cloth", | |||||
| "Cyberano_Ns:FrontBelt2", | |||||
| "Cyberano_Ns:RightToeBase", | |||||
| "Cyberano_Ns:LeftToeBase", | |||||
| "Cyberano_Ns:Head", | |||||
| "Cyberano_Ns:RightArm", | |||||
| "Cyberano_Ns:RightSpaulder1", | |||||
| "Cyberano_Ns:RightSpaulder2", | |||||
| "Cyberano_Ns:LeftArm", | |||||
| "Cyberano_Ns:LeftSpaulder1", | |||||
| "Cyberano_Ns:LeftCloth01", | |||||
| "Cyberano_Ns:MiddleCloth01", | |||||
| "Cyberano_Ns:RightCloth01", | |||||
| "Cyberano_Ns:FrontBelt3", | |||||
| "Cyberano_Ns:RightoeEnd", | |||||
| "Cyberano_Ns:LeftoeEnd", | |||||
| "Cyberano_Ns:HeadEnd", | |||||
| "Cyberano_Ns:Cap", | |||||
| "Cyberano_Ns:RightForeArm", | |||||
| "Cyberano_Ns:RightArmRoll", | |||||
| "Cyberano_Ns:LeftForeArm", | |||||
| "Cyberano_Ns:LeftArmRoll", | |||||
| "Cyberano_Ns:LeftCloth02", | |||||
| "Cyberano_Ns:MiddleCloth02", | |||||
| "Cyberano_Ns:RightCloth02", | |||||
| "Cyberano_Ns:Feather01", | |||||
| "Cyberano_Ns:RightHand", | |||||
| "Cyberano_Ns:RightForeArmRoll", | |||||
| "Cyberano_Ns:LeftHand", | |||||
| "Cyberano_Ns:LeftForeArmRoll", | |||||
| "Cyberano_Ns:LeftCloth03", | |||||
| "Cyberano_Ns:MiddleCloth03", | |||||
| "Cyberano_Ns:RightCloth03", | |||||
| "Cyberano_Ns:Feather02", | |||||
| "Cyberano_Ns:RightThumb1", | |||||
| "Cyberano_Ns:RightIndex1", | |||||
| "Cyberano_Ns:RightMiddle1", | |||||
| "Cyberano_Ns:RightRing1", | |||||
| "Cyberano_Ns:RightCuff", | |||||
| "Cyberano_Ns:LeftThumb1", | |||||
| "Cyberano_Ns:LeftIndex1", | |||||
| "Cyberano_Ns:LeftMiddle1", | |||||
| "Cyberano_Ns:LeftRing1", | |||||
| "Cyberano_Ns:LeftCloth04", | |||||
| "Cyberano_Ns:MiddleCloth04", | |||||
| "Cyberano_Ns:RightCloth04", | |||||
| "Cyberano_Ns:Feather03", | |||||
| "Cyberano_Ns:RightThumb2", | |||||
| "Cyberano_Ns:RightIndex2", | |||||
| "Cyberano_Ns:RightMiddle2", | |||||
| "Cyberano_Ns:RightRing2", | |||||
| "Cyberano_Ns:LeftThumb2", | |||||
| "Cyberano_Ns:LeftIndex2", | |||||
| "Cyberano_Ns:LeftMiddle2", | |||||
| "Cyberano_Ns:LeftRing2", | |||||
| "Cyberano_Ns:Feather04", | |||||
| "Cyberano_Ns:RightThumb3", | |||||
| "Cyberano_Ns:RightIndex3", | |||||
| "Cyberano_Ns:RightMiddle3", | |||||
| "Cyberano_Ns:RightRing3", | |||||
| "Cyberano_Ns:LeftThumb3", | |||||
| "Cyberano_Ns:LeftIndex3", | |||||
| "Cyberano_Ns:LeftMiddle3", | |||||
| "Cyberano_Ns:LeftRing3", | |||||
| "Cyberano_Ns:Feather05", | |||||
| "Cyberano_Ns:RightThumb4", | |||||
| "Cyberano_Ns:RightIndex4", | |||||
| "Cyberano_Ns:RightMiddle4", | |||||
| "Cyberano_Ns:RightRing4", | |||||
| "Cyberano_Ns:LeftThumb4", | |||||
| "Cyberano_Ns:LeftIndex4", | |||||
| "Cyberano_Ns:LeftMiddle4", | |||||
| "Cyberano_Ns:LeftRing4", | |||||
| "Cyberano_Ns:Feather06", | |||||
| "Cyberano_Ns:Feather07", | |||||
| "Cyberano_Ns:Feather08", | |||||
| "Cyberano_Ns:Feather09", | |||||
| "Cyberano_Ns:Feather10", | |||||
| "Cyberano_Ns:Feather11", | |||||
| "Cyberano_Ns:Feather12", | |||||
| "Cyberano_Ns:Feather13", | |||||
| "Cyberano_Ns:Feather14", | |||||
| "Cyberano_Ns:Feather15", | |||||
| "Cyberano_Ns:Feather16", | |||||
| "Cyberano_Ns:Feather17" | |||||
| }; | |||||
| map<String, int> bones_map; | map<String, int> bones_map; | ||||
| for (int i = 0; i < bones.count(); ++i) | for (int i = 0; i < bones.count(); ++i) | ||||
| @@ -20,10 +20,6 @@ namespace lol | |||||
| lolunit_declare_fixture(string_test) | lolunit_declare_fixture(string_test) | ||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(string_build) | lolunit_declare_test(string_build) | ||||
| { | { | ||||
| String s1; | String s1; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,9 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(BuildTest) | |||||
| lolunit_declare_fixture(build_features) | |||||
| { | { | ||||
| lolunit_declare_test(TypeSizeHalf) | |||||
| lolunit_declare_test(half_type_sizes) | |||||
| { | { | ||||
| lolunit_assert_equal(sizeof(half), 2); | lolunit_assert_equal(sizeof(half), 2); | ||||
| @@ -34,7 +34,7 @@ lolunit_declare_fixture(BuildTest) | |||||
| #endif | #endif | ||||
| } | } | ||||
| lolunit_declare_test(TypeSizeFloat) | |||||
| lolunit_declare_test(float_type_sizes) | |||||
| { | { | ||||
| lolunit_assert_equal(sizeof(float), 4); | lolunit_assert_equal(sizeof(float), 4); | ||||
| @@ -47,7 +47,7 @@ lolunit_declare_fixture(BuildTest) | |||||
| lolunit_assert_equal(sizeof(mat4), 64); | lolunit_assert_equal(sizeof(mat4), 64); | ||||
| } | } | ||||
| lolunit_declare_test(TypeSizeDouble) | |||||
| lolunit_declare_test(double_type_sizes) | |||||
| { | { | ||||
| lolunit_assert_equal(sizeof(double), 8); | lolunit_assert_equal(sizeof(double), 8); | ||||
| @@ -60,7 +60,7 @@ lolunit_declare_fixture(BuildTest) | |||||
| lolunit_assert_equal(sizeof(dmat4), 128); | lolunit_assert_equal(sizeof(dmat4), 128); | ||||
| } | } | ||||
| lolunit_declare_test(TypeSizeInt8) | |||||
| lolunit_declare_test(int8_type_sizes) | |||||
| { | { | ||||
| lolunit_assert_equal(sizeof(i8vec2), 2); | lolunit_assert_equal(sizeof(i8vec2), 2); | ||||
| lolunit_assert_equal(sizeof(u8vec2), 2); | lolunit_assert_equal(sizeof(u8vec2), 2); | ||||
| @@ -70,7 +70,7 @@ lolunit_declare_fixture(BuildTest) | |||||
| lolunit_assert_equal(sizeof(u8vec4), 4); | lolunit_assert_equal(sizeof(u8vec4), 4); | ||||
| } | } | ||||
| lolunit_declare_test(TypeSizeInt16) | |||||
| lolunit_declare_test(int16_type_sizes) | |||||
| { | { | ||||
| lolunit_assert_equal(sizeof(i16vec2), 4); | lolunit_assert_equal(sizeof(i16vec2), 4); | ||||
| lolunit_assert_equal(sizeof(u16vec2), 4); | lolunit_assert_equal(sizeof(u16vec2), 4); | ||||
| @@ -80,7 +80,7 @@ lolunit_declare_fixture(BuildTest) | |||||
| lolunit_assert_equal(sizeof(u16vec4), 8); | lolunit_assert_equal(sizeof(u16vec4), 8); | ||||
| } | } | ||||
| lolunit_declare_test(TypeSizeInt32) | |||||
| lolunit_declare_test(int32_type_sizes) | |||||
| { | { | ||||
| lolunit_assert_equal(sizeof(ivec2), 8); | lolunit_assert_equal(sizeof(ivec2), 8); | ||||
| lolunit_assert_equal(sizeof(uvec2), 8); | lolunit_assert_equal(sizeof(uvec2), 8); | ||||
| @@ -90,7 +90,7 @@ lolunit_declare_fixture(BuildTest) | |||||
| lolunit_assert_equal(sizeof(uvec4), 16); | lolunit_assert_equal(sizeof(uvec4), 16); | ||||
| } | } | ||||
| lolunit_declare_test(TypeSizeInt64) | |||||
| lolunit_declare_test(int64_type_sizes) | |||||
| { | { | ||||
| lolunit_assert_equal(sizeof(i64vec2), 16); | lolunit_assert_equal(sizeof(i64vec2), 16); | ||||
| lolunit_assert_equal(sizeof(u64vec2), 16); | lolunit_assert_equal(sizeof(u64vec2), 16); | ||||
| @@ -101,7 +101,7 @@ lolunit_declare_fixture(BuildTest) | |||||
| } | } | ||||
| #if !defined LOL_BUILD_DEBUG | #if !defined LOL_BUILD_DEBUG | ||||
| lolunit_declare_test(FastMath) | |||||
| lolunit_declare_test(fast_math) | |||||
| { | { | ||||
| double x, y; | double x, y; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // © 2013 Benjamin “Touky” Huet <huet.benjamin@gmail.com> | // © 2013 Benjamin “Touky” Huet <huet.benjamin@gmail.com> | ||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| @@ -18,23 +18,17 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(CameraTest) | |||||
| lolunit_declare_fixture(camera_test) | |||||
| { | { | ||||
| Camera tc; | |||||
| vec3 eye; | |||||
| vec3 target; | |||||
| vec3 up; | |||||
| mat4 m_lookat; | |||||
| quat q_lookat; | |||||
| vec3 v_lookat; | |||||
| float fov; | |||||
| float screen_size; | |||||
| float screen_ratio; | |||||
| float near; | |||||
| float far; | |||||
| bool is_shifted; | |||||
| void SetUp() | |||||
| Camera tc; | |||||
| vec3 eye, target, up; | |||||
| mat4 m_lookat; | |||||
| quat q_lookat; | |||||
| vec3 v_lookat; | |||||
| float fov, screen_size, screen_ratio, near, far; | |||||
| bool is_shifted; | |||||
| void setup() | |||||
| { | { | ||||
| eye = vec3(0.f, 0.f, 50.f); | eye = vec3(0.f, 0.f, 50.f); | ||||
| target = vec3::zero; | target = vec3::zero; | ||||
| @@ -50,14 +44,12 @@ lolunit_declare_fixture(CameraTest) | |||||
| is_shifted = false; | is_shifted = false; | ||||
| } | } | ||||
| void TearDown() {} | |||||
| #define TEST_VECTOR(v0, v1) \ | #define TEST_VECTOR(v0, v1) \ | ||||
| lolunit_assert_doubles_equal(v0.x, v1.x, 1.e-5f); \ | lolunit_assert_doubles_equal(v0.x, v1.x, 1.e-5f); \ | ||||
| lolunit_assert_doubles_equal(v0.y, v1.y, 1.e-5f); \ | lolunit_assert_doubles_equal(v0.y, v1.y, 1.e-5f); \ | ||||
| lolunit_assert_doubles_equal(v0.z, v1.z, 1.e-5f); | lolunit_assert_doubles_equal(v0.z, v1.z, 1.e-5f); | ||||
| lolunit_declare_test(SetViewTest) | |||||
| lolunit_declare_test(set_view_test) | |||||
| { | { | ||||
| tc.SetView(eye, target, up); | tc.SetView(eye, target, up); | ||||
| TEST_VECTOR(eye, tc.GetPosition()); | TEST_VECTOR(eye, tc.GetPosition()); | ||||
| @@ -105,7 +97,7 @@ lolunit_declare_fixture(CameraTest) | |||||
| lolunit_assert_doubles_equal(m0[3][3], m1[3][3], 1.e-5f); | lolunit_assert_doubles_equal(m0[3][3], m1[3][3], 1.e-5f); | ||||
| lolunit_declare_test(SetProjectionTest) | |||||
| lolunit_declare_test(set_projection_test) | |||||
| { | { | ||||
| mat4 refmx = mat4::perspective(fov, screen_size, screen_size * screen_ratio, near, far); | mat4 refmx = mat4::perspective(fov, screen_size, screen_size * screen_ratio, near, far); | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -59,13 +59,9 @@ static float const ciede2k[] = | |||||
| 2.0776f, 0.0795f, -1.1350f, 0.9033f, -0.0636f, -0.5514f, 0.9082f, | 2.0776f, 0.0795f, -1.1350f, 0.9033f, -0.0636f, -0.5514f, 0.9082f, | ||||
| }; | }; | ||||
| lolunit_declare_fixture(ColorTest) | |||||
| lolunit_declare_fixture(color_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(CIEDE2000) | |||||
| lolunit_declare_test(ciede2000) | |||||
| { | { | ||||
| size_t count = sizeof(ciede2k) / sizeof(*ciede2k); | size_t count = sizeof(ciede2k) / sizeof(*ciede2k); | ||||
| @@ -87,7 +83,7 @@ lolunit_declare_fixture(ColorTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(RGBToHSV) | |||||
| lolunit_declare_test(rgb_to_hsv) | |||||
| { | { | ||||
| for (int r = 0; r < 20; r++) | for (int r = 0; r < 20; r++) | ||||
| for (int g = 0; g < 20; g++) | for (int g = 0; g < 20; g++) | ||||
| @@ -109,7 +105,7 @@ lolunit_declare_fixture(ColorTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(RGBToHSL) | |||||
| lolunit_declare_test(rgb_to_hsl) | |||||
| { | { | ||||
| for (int r = 0; r < 20; r++) | for (int r = 0; r < 20; r++) | ||||
| for (int g = 0; g < 20; g++) | for (int g = 0; g < 20; g++) | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -19,9 +19,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(ImageTest) | |||||
| lolunit_declare_fixture(image_test) | |||||
| { | { | ||||
| lolunit_declare_test(OpenImage) | |||||
| lolunit_declare_test(open_image) | |||||
| { | { | ||||
| Image image("data/gradient.png"); | Image image("data/gradient.png"); | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,13 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(Array2DTest) | |||||
| lolunit_declare_fixture(array2d_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(Array2DCreate) | |||||
| lolunit_declare_test(array2d_create) | |||||
| { | { | ||||
| array2d<int> a(ivec2(10, 10)); | array2d<int> a(ivec2(10, 10)); | ||||
| @@ -45,7 +41,7 @@ lolunit_declare_fixture(Array2DTest) | |||||
| lolunit_assert_equal(b[9][9], 8); | lolunit_assert_equal(b[9][9], 8); | ||||
| } | } | ||||
| lolunit_declare_test(Array2DInit) | |||||
| lolunit_declare_test(array2d_init) | |||||
| { | { | ||||
| array2d<int> a = { { 1, 2, 3, 4 }, | array2d<int> a = { { 1, 2, 3, 4 }, | ||||
| { 5, 6, 7, 8 }, | { 5, 6, 7, 8 }, | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,13 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(Array3DTest) | |||||
| lolunit_declare_fixture(array3d_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(Array3DCreate) | |||||
| lolunit_declare_test(array3d_create) | |||||
| { | { | ||||
| array3d<int> a(ivec3(10, 10, 10)); | array3d<int> a(ivec3(10, 10, 10)); | ||||
| @@ -45,7 +41,7 @@ lolunit_declare_fixture(Array3DTest) | |||||
| lolunit_assert_equal(b[9][9][9], 8); | lolunit_assert_equal(b[9][9][9], 8); | ||||
| } | } | ||||
| lolunit_declare_test(Array3DInit) | |||||
| lolunit_declare_test(array3d_init) | |||||
| { | { | ||||
| array3d<int> a = { { { 1, 2, 3, 4 }, | array3d<int> a = { { { 1, 2, 3, 4 }, | ||||
| { 5, 6, 7, 8 }, | { 5, 6, 7, 8 }, | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,13 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(ArrayNDTest) | |||||
| lolunit_declare_fixture(arraynd_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(Array2D) | |||||
| lolunit_declare_test(array2d_accessors) | |||||
| { | { | ||||
| arraynd<2, int> a; | arraynd<2, int> a; | ||||
| a.resize(vec_t<int, 2>(2, 2)); | a.resize(vec_t<int, 2>(2, 2)); | ||||
| @@ -46,7 +42,7 @@ lolunit_declare_fixture(ArrayNDTest) | |||||
| lolunit_assert_equal(b[1][1], 4); | lolunit_assert_equal(b[1][1], 4); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayNDCreate) | |||||
| lolunit_declare_test(arraynd_create) | |||||
| { | { | ||||
| arraynd<10, int> a; | arraynd<10, int> a; | ||||
| arraynd<20, float> b; | arraynd<20, float> b; | ||||
| @@ -92,7 +88,7 @@ lolunit_declare_fixture(ArrayNDTest) | |||||
| lolunit_assert_equal(f[3][1][1], 0); | lolunit_assert_equal(f[3][1][1], 0); | ||||
| } | } | ||||
| lolunit_declare_test(ArrayNDInit) | |||||
| lolunit_declare_test(arraynd_init) | |||||
| { | { | ||||
| int const NDIM = 8; | int const NDIM = 8; | ||||
| vec_t<int, NDIM> size; | vec_t<int, NDIM> size; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,13 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(BoxTest) | |||||
| lolunit_declare_fixture(box_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(Box2DIsect) | |||||
| lolunit_declare_test(box2d_intersection) | |||||
| { | { | ||||
| box2 b1(vec2(0.f, 0.f), vec2(10.f, 10.f)); | box2 b1(vec2(0.f, 0.f), vec2(10.f, 10.f)); | ||||
| box2 b2(vec2(5.f, 8.f), vec2(8.f, 12.f)); | box2 b2(vec2(5.f, 8.f), vec2(8.f, 12.f)); | ||||
| @@ -38,7 +34,7 @@ lolunit_declare_fixture(BoxTest) | |||||
| lolunit_assert_equal(false, TestAABBVsAABB(b4, b5)); | lolunit_assert_equal(false, TestAABBVsAABB(b4, b5)); | ||||
| } | } | ||||
| lolunit_declare_test(Box2DMove) | |||||
| lolunit_declare_test(box2d_move) | |||||
| { | { | ||||
| box2 b1(vec2(0.f, 0.f), vec2(1.f, 1.f)); | box2 b1(vec2(0.f, 0.f), vec2(1.f, 1.f)); | ||||
| box2 b2(vec2(2.f, 2.f), vec2(3.f, 3.f)); | box2 b2(vec2(2.f, 2.f), vec2(3.f, 3.f)); | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,28 +17,24 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(ComplexTest) | |||||
| lolunit_declare_fixture(complex_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(Equality) | |||||
| lolunit_declare_test(equality) | |||||
| { | { | ||||
| cmplx a2(1.0f, 2.0f); | cmplx a2(1.0f, 2.0f); | ||||
| cmplx b2(0.0f, 2.0f); | cmplx b2(0.0f, 2.0f); | ||||
| cmplx c2(1.0f, 0.0f); | cmplx c2(1.0f, 0.0f); | ||||
| lolunit_assert_equal(a2, a2); | lolunit_assert_equal(a2, a2); | ||||
| lolunit_assert_not_different(a2, a2); | |||||
| lolunit_refute_different(a2, a2); | |||||
| lolunit_assert_different(a2, b2); | lolunit_assert_different(a2, b2); | ||||
| lolunit_assert_not_equal(a2, b2); | |||||
| lolunit_refute_equal(a2, b2); | |||||
| lolunit_assert_different(a2, c2); | lolunit_assert_different(a2, c2); | ||||
| lolunit_assert_not_equal(a2, c2); | |||||
| lolunit_refute_equal(a2, c2); | |||||
| } | } | ||||
| lolunit_declare_test(UnaryMinus) | |||||
| lolunit_declare_test(unary_minus) | |||||
| { | { | ||||
| cmplx a(1.0f, 3.0f); | cmplx a(1.0f, 3.0f); | ||||
| cmplx b(-1.0f, -3.0f); | cmplx b(-1.0f, -3.0f); | ||||
| @@ -47,7 +43,7 @@ lolunit_declare_fixture(ComplexTest) | |||||
| lolunit_assert_equal(-a, b); | lolunit_assert_equal(-a, b); | ||||
| } | } | ||||
| lolunit_declare_test(Conjugate) | |||||
| lolunit_declare_test(conjugate) | |||||
| { | { | ||||
| cmplx a(1.0f, 3.0f); | cmplx a(1.0f, 3.0f); | ||||
| cmplx b(1.0f, -3.0f); | cmplx b(1.0f, -3.0f); | ||||
| @@ -56,7 +52,7 @@ lolunit_declare_fixture(ComplexTest) | |||||
| lolunit_assert_equal(~a, b); | lolunit_assert_equal(~a, b); | ||||
| } | } | ||||
| lolunit_declare_test(Norm) | |||||
| lolunit_declare_test(complex_norm) | |||||
| { | { | ||||
| cmplx a(3.0f, -4.0f); | cmplx a(3.0f, -4.0f); | ||||
| @@ -73,7 +69,7 @@ lolunit_declare_fixture(ComplexTest) | |||||
| lolunit_assert_equal(norm(a * d), norm(a) * norm(d)); | lolunit_assert_equal(norm(a * d), norm(a) * norm(d)); | ||||
| } | } | ||||
| lolunit_declare_test(Base) | |||||
| lolunit_declare_test(base) | |||||
| { | { | ||||
| cmplx one(1.0f, 0.0f); | cmplx one(1.0f, 0.0f); | ||||
| cmplx i(0.0f, 1.0f); | cmplx i(0.0f, 1.0f); | ||||
| @@ -84,7 +80,7 @@ lolunit_declare_fixture(ComplexTest) | |||||
| lolunit_assert_equal(i * i, -one); | lolunit_assert_equal(i * i, -one); | ||||
| } | } | ||||
| lolunit_declare_test(Normalize) | |||||
| lolunit_declare_test(complex_normalize) | |||||
| { | { | ||||
| cmplx a(3.0f, -4.0f); | cmplx a(3.0f, -4.0f); | ||||
| cmplx b = normalize(a); | cmplx b = normalize(a); | ||||
| @@ -92,7 +88,7 @@ lolunit_declare_fixture(ComplexTest) | |||||
| lolunit_assert_doubles_equal(norm(b), 1.0, 1e-8); | lolunit_assert_doubles_equal(norm(b), 1.0, 1e-8); | ||||
| } | } | ||||
| lolunit_declare_test(Reciprocal) | |||||
| lolunit_declare_test(reciprocal) | |||||
| { | { | ||||
| cmplx a(3.0f, -4.0f); | cmplx a(3.0f, -4.0f); | ||||
| cmplx b = re(a); | cmplx b = re(a); | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -19,9 +19,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(HalfTest) | |||||
| lolunit_declare_fixture(half_test) | |||||
| { | { | ||||
| lolunit_declare_test(FloatToHalf) | |||||
| lolunit_declare_test(float_to_half) | |||||
| { | { | ||||
| for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++) | for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++) | ||||
| { | { | ||||
| @@ -32,7 +32,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(FloatToHalfAccurate) | |||||
| lolunit_declare_test(float_to_half_accurate) | |||||
| { | { | ||||
| for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++) | for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++) | ||||
| { | { | ||||
| @@ -43,7 +43,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(BitsToHalf) | |||||
| lolunit_declare_test(bits_to_half) | |||||
| { | { | ||||
| for (unsigned int i = 0; i < 0x10000; i++) | for (unsigned int i = 0; i < 0x10000; i++) | ||||
| { | { | ||||
| @@ -54,7 +54,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(HalfIsNaN) | |||||
| lolunit_declare_test(half_is_nan) | |||||
| { | { | ||||
| lolunit_assert(half::makebits(0x7c01).is_nan()); | lolunit_assert(half::makebits(0x7c01).is_nan()); | ||||
| lolunit_assert(half::makebits(0xfc01).is_nan()); | lolunit_assert(half::makebits(0xfc01).is_nan()); | ||||
| @@ -70,7 +70,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| lolunit_assert(!half(-2.0f).is_nan()); | lolunit_assert(!half(-2.0f).is_nan()); | ||||
| } | } | ||||
| lolunit_declare_test(HalfIsInf) | |||||
| lolunit_declare_test(half_is_inf) | |||||
| { | { | ||||
| lolunit_assert(half(65536.0f).is_inf()); | lolunit_assert(half(65536.0f).is_inf()); | ||||
| lolunit_assert(half(-65536.0f).is_inf()); | lolunit_assert(half(-65536.0f).is_inf()); | ||||
| @@ -87,7 +87,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| lolunit_assert(!half::makebits(0xfe00).is_inf()); | lolunit_assert(!half::makebits(0xfe00).is_inf()); | ||||
| } | } | ||||
| lolunit_declare_test(HalfIsFinite) | |||||
| lolunit_declare_test(half_is_finite) | |||||
| { | { | ||||
| lolunit_assert(half(0.0f).is_finite()); | lolunit_assert(half(0.0f).is_finite()); | ||||
| lolunit_assert(half(-0.0f).is_finite()); | lolunit_assert(half(-0.0f).is_finite()); | ||||
| @@ -104,7 +104,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| lolunit_assert(!half::makebits(0xfe00).is_finite()); | lolunit_assert(!half::makebits(0xfe00).is_finite()); | ||||
| } | } | ||||
| lolunit_declare_test(HalfIsNormal) | |||||
| lolunit_declare_test(half_is_normal) | |||||
| { | { | ||||
| lolunit_assert(half(0.0f).is_normal()); | lolunit_assert(half(0.0f).is_normal()); | ||||
| lolunit_assert(half(-0.0f).is_normal()); | lolunit_assert(half(-0.0f).is_normal()); | ||||
| @@ -121,7 +121,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| lolunit_assert(!half::makebits(0xfe00).is_normal()); | lolunit_assert(!half::makebits(0xfe00).is_normal()); | ||||
| } | } | ||||
| lolunit_declare_test(HalfClassify) | |||||
| lolunit_declare_test(half_classify) | |||||
| { | { | ||||
| for (uint32_t i = 0; i < 0x10000; i++) | for (uint32_t i = 0; i < 0x10000; i++) | ||||
| { | { | ||||
| @@ -145,7 +145,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(HalfToFloat) | |||||
| lolunit_declare_test(half_to_float) | |||||
| { | { | ||||
| for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++) | for (size_t i = 0; i < sizeof(pairs) / sizeof(*pairs); i++) | ||||
| { | { | ||||
| @@ -168,7 +168,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(HalfToInt) | |||||
| lolunit_declare_test(half_to_int) | |||||
| { | { | ||||
| lolunit_assert_equal((int)(half)(0.0f), 0); | lolunit_assert_equal((int)(half)(0.0f), 0); | ||||
| lolunit_assert_equal((int)(half)(-0.0f), 0); | lolunit_assert_equal((int)(half)(-0.0f), 0); | ||||
| @@ -182,7 +182,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| lolunit_assert_equal((int)(half)(-65504.0f), -65504); | lolunit_assert_equal((int)(half)(-65504.0f), -65504); | ||||
| } | } | ||||
| lolunit_declare_test(FloatOpHalf) | |||||
| lolunit_declare_test(float_op_half) | |||||
| { | { | ||||
| half zero = 0; | half zero = 0; | ||||
| half one = 1; | half one = 1; | ||||
| @@ -223,7 +223,7 @@ lolunit_declare_fixture(HalfTest) | |||||
| lolunit_assert_equal(2.0f, f); | lolunit_assert_equal(2.0f, f); | ||||
| } | } | ||||
| lolunit_declare_test(HalfOpFloat) | |||||
| lolunit_declare_test(half_op_float) | |||||
| { | { | ||||
| half zero = 0; | half zero = 0; | ||||
| half one = 1; | half one = 1; | ||||
| @@ -265,12 +265,12 @@ lolunit_declare_fixture(HalfTest) | |||||
| lolunit_assert_equal(two.bits, f.bits); | lolunit_assert_equal(two.bits, f.bits); | ||||
| } | } | ||||
| struct TestPair { float f; uint16_t x; }; | |||||
| struct test_pair { float f; uint16_t x; }; | |||||
| static TestPair const pairs[11]; | |||||
| static test_pair const pairs[11]; | |||||
| }; | }; | ||||
| HalfTest::TestPair const HalfTest::pairs[] = | |||||
| half_test::test_pair const half_test::pairs[] = | |||||
| { | { | ||||
| /* All these values have exact half representations */ | /* All these values have exact half representations */ | ||||
| { 0.0f, 0x0000 }, | { 0.0f, 0x0000 }, | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,13 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(InterpTest) | |||||
| lolunit_declare_fixture(interp_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(TimeInterpTest) | |||||
| lolunit_declare_test(time_interp_test) | |||||
| { | { | ||||
| TimeInterp<float> ti; | TimeInterp<float> ti; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,9 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(MatrixTest) | |||||
| lolunit_declare_fixture(matrix_test) | |||||
| { | { | ||||
| void SetUp() | |||||
| void setup() | |||||
| { | { | ||||
| tri2 = mat2(vec2(1.0f, 0.0f), | tri2 = mat2(vec2(1.0f, 0.0f), | ||||
| vec2(7.0f, 2.0f)); | vec2(7.0f, 2.0f)); | ||||
| @@ -43,9 +43,7 @@ lolunit_declare_fixture(MatrixTest) | |||||
| vec4( 5.0f, -3.0f, -7.0f, -6.0f)); | vec4( 5.0f, -3.0f, -7.0f, -6.0f)); | ||||
| } | } | ||||
| void TearDown() {} | |||||
| lolunit_declare_test(Determinant) | |||||
| lolunit_declare_test(matrix_determinant) | |||||
| { | { | ||||
| float d1, d2; | float d1, d2; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // © 2013—2014 Benjamin “Touky” Huet <huet.benjamin@gmail.com> | // © 2013—2014 Benjamin “Touky” Huet <huet.benjamin@gmail.com> | ||||
| // © 2013—2014 Guillaume Bittoun <guillaume.bittoun@gmail.com> | // © 2013—2014 Guillaume Bittoun <guillaume.bittoun@gmail.com> | ||||
| // | // | ||||
| @@ -19,11 +19,8 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(SimplexNoise) | |||||
| lolunit_declare_fixture(simplex_noise_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| }; | }; | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,15 +17,15 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_declare_fixture(polynomial_test) | |||||
| { | { | ||||
| lolunit_declare_test(Declaration) | |||||
| lolunit_declare_test(declaration) | |||||
| { | { | ||||
| polynomial<float> p; | polynomial<float> p; | ||||
| polynomial<real> q; | polynomial<real> q; | ||||
| } | } | ||||
| lolunit_declare_test(Init) | |||||
| lolunit_declare_test(init) | |||||
| { | { | ||||
| polynomial<float> p { }; | polynomial<float> p { }; | ||||
| lolunit_assert_equal(p[0], 0.f); | lolunit_assert_equal(p[0], 0.f); | ||||
| @@ -52,7 +52,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(s.degree(), -1); | lolunit_assert_equal(s.degree(), -1); | ||||
| } | } | ||||
| lolunit_declare_test(Derive) | |||||
| lolunit_declare_test(derive) | |||||
| { | { | ||||
| polynomial<float> p {}; | polynomial<float> p {}; | ||||
| p = p.derive(); | p = p.derive(); | ||||
| @@ -75,7 +75,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(s[2], 12.f); | lolunit_assert_equal(s[2], 12.f); | ||||
| } | } | ||||
| lolunit_declare_test(Eval) | |||||
| lolunit_declare_test(eval) | |||||
| { | { | ||||
| /* Special null polynomial */ | /* Special null polynomial */ | ||||
| polynomial<float> p; | polynomial<float> p; | ||||
| @@ -84,7 +84,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(a, 0.f); | lolunit_assert_equal(a, 0.f); | ||||
| } | } | ||||
| lolunit_declare_test(Eval0) | |||||
| lolunit_declare_test(eval_degree_0) | |||||
| { | { | ||||
| /* Constant polynomial p(x) = 1 */ | /* Constant polynomial p(x) = 1 */ | ||||
| polynomial<float> p { 1.f }; | polynomial<float> p { 1.f }; | ||||
| @@ -93,7 +93,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(a, 1.f); | lolunit_assert_equal(a, 1.f); | ||||
| } | } | ||||
| lolunit_declare_test(Eval1) | |||||
| lolunit_declare_test(eval_degree_1) | |||||
| { | { | ||||
| /* p(x) = 1 + 2x */ | /* p(x) = 1 + 2x */ | ||||
| polynomial<float> p { 1.f, 2.f }; | polynomial<float> p { 1.f, 2.f }; | ||||
| @@ -108,7 +108,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(c, 5.f); | lolunit_assert_equal(c, 5.f); | ||||
| } | } | ||||
| lolunit_declare_test(Eval2) | |||||
| lolunit_declare_test(eval_degree_2) | |||||
| { | { | ||||
| /* p(x) = 1 + 2x + 3x² */ | /* p(x) = 1 + 2x + 3x² */ | ||||
| polynomial<float> p { 1.f, 2.f, 3.f }; | polynomial<float> p { 1.f, 2.f, 3.f }; | ||||
| @@ -123,7 +123,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(c, 17.f); | lolunit_assert_equal(c, 17.f); | ||||
| } | } | ||||
| lolunit_declare_test(UnaryPlusMinus) | |||||
| lolunit_declare_test(unary_plus_and_minus) | |||||
| { | { | ||||
| /* p(x) = 1 + 2x + 3x² */ | /* p(x) = 1 + 2x + 3x² */ | ||||
| polynomial<float> p { 1.f, 2.f, 3.f }; | polynomial<float> p { 1.f, 2.f, 3.f }; | ||||
| @@ -139,7 +139,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(r[2], -3.f); | lolunit_assert_equal(r[2], -3.f); | ||||
| } | } | ||||
| lolunit_declare_test(Addition) | |||||
| lolunit_declare_test(addition) | |||||
| { | { | ||||
| /* p(x) = 1 + 2x + 3x² */ | /* p(x) = 1 + 2x + 3x² */ | ||||
| /* q(x) = 4 + 5x */ | /* q(x) = 4 + 5x */ | ||||
| @@ -154,7 +154,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(r[2], 3.f); | lolunit_assert_equal(r[2], 3.f); | ||||
| } | } | ||||
| lolunit_declare_test(Subtraction) | |||||
| lolunit_declare_test(subtraction) | |||||
| { | { | ||||
| /* p(x) = 1 + 2x + 3x² */ | /* p(x) = 1 + 2x + 3x² */ | ||||
| /* q(x) = 4 + 5x */ | /* q(x) = 4 + 5x */ | ||||
| @@ -169,7 +169,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(r[2], 3.f); | lolunit_assert_equal(r[2], 3.f); | ||||
| } | } | ||||
| lolunit_declare_test(Multiplication) | |||||
| lolunit_declare_test(multiplication) | |||||
| { | { | ||||
| /* p(x) = 1 + 2x + 3x² */ | /* p(x) = 1 + 2x + 3x² */ | ||||
| /* q(x) = 4 + 5x */ | /* q(x) = 4 + 5x */ | ||||
| @@ -185,7 +185,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(r[3], 15.f); | lolunit_assert_equal(r[3], 15.f); | ||||
| } | } | ||||
| lolunit_declare_test(Division) | |||||
| lolunit_declare_test(division) | |||||
| { | { | ||||
| /* p(x) = -4 - 2x² + x³ */ | /* p(x) = -4 - 2x² + x³ */ | ||||
| /* q(x) = -3 + x */ | /* q(x) = -3 + x */ | ||||
| @@ -204,7 +204,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_doubles_equal(r.m2[0], 5.f, 1e-5f); | lolunit_assert_doubles_equal(r.m2[0], 5.f, 1e-5f); | ||||
| } | } | ||||
| lolunit_declare_test(Composition1) | |||||
| lolunit_declare_test(composition_degree_2_2) | |||||
| { | { | ||||
| /* p(x) = 1 + x² */ | /* p(x) = 1 + x² */ | ||||
| polynomial<float> p({ 1, 0, 1 }); | polynomial<float> p({ 1, 0, 1 }); | ||||
| @@ -219,7 +219,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(q[4], 1.f); | lolunit_assert_equal(q[4], 1.f); | ||||
| } | } | ||||
| lolunit_declare_test(Composition2) | |||||
| lolunit_declare_test(composition_degree_2_3) | |||||
| { | { | ||||
| /* p(x) = 1 + x */ | /* p(x) = 1 + x */ | ||||
| polynomial<float> p({ 1, 1 }); | polynomial<float> p({ 1, 1 }); | ||||
| @@ -235,7 +235,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(r[2], 1.f); | lolunit_assert_equal(r[2], 1.f); | ||||
| } | } | ||||
| lolunit_declare_test(RootsDegree0) | |||||
| lolunit_declare_test(degree_0_root) | |||||
| { | { | ||||
| /* p(x) = 42 */ | /* p(x) = 42 */ | ||||
| polynomial<float> p { 42.f }; | polynomial<float> p { 42.f }; | ||||
| @@ -244,7 +244,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(roots.count(), 0); | lolunit_assert_equal(roots.count(), 0); | ||||
| } | } | ||||
| lolunit_declare_test(RootsDegree1) | |||||
| lolunit_declare_test(degree_1_root) | |||||
| { | { | ||||
| /* p(x) = -6 + 2x */ | /* p(x) = -6 + 2x */ | ||||
| polynomial<float> p { -6.f, 2.f }; | polynomial<float> p { -6.f, 2.f }; | ||||
| @@ -254,7 +254,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(roots[0], 3.f); | lolunit_assert_equal(roots[0], 3.f); | ||||
| } | } | ||||
| lolunit_declare_test(RootsDegree2) | |||||
| lolunit_declare_test(degree_2_root) | |||||
| { | { | ||||
| /* p(x) = 81 - 18x + x² */ | /* p(x) = 81 - 18x + x² */ | ||||
| polynomial<float> p { 81.f, -18.f, 1.f }; | polynomial<float> p { 81.f, -18.f, 1.f }; | ||||
| @@ -272,7 +272,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_equal(roots2[1], 7.f); | lolunit_assert_equal(roots2[1], 7.f); | ||||
| } | } | ||||
| lolunit_declare_test(RootsDegree3TripleSolution) | |||||
| lolunit_declare_test(degree_3_triple_root) | |||||
| { | { | ||||
| polynomial<float> p { 1.f, 3.f, 3.f, 1.f }; | polynomial<float> p { 1.f, 3.f, 3.f, 1.f }; | ||||
| auto roots1 = p.roots(); | auto roots1 = p.roots(); | ||||
| @@ -281,7 +281,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_doubles_equal(roots1[0], -1, 0); | lolunit_assert_doubles_equal(roots1[0], -1, 0); | ||||
| } | } | ||||
| lolunit_declare_test(RootsDegree3DoubleSolution) | |||||
| lolunit_declare_test(degree_3_double_root) | |||||
| { | { | ||||
| polynomial<float> p { 2.f, 5.f, 4.f, 1.f }; | polynomial<float> p { 2.f, 5.f, 4.f, 1.f }; | ||||
| auto roots1 = p.roots(); | auto roots1 = p.roots(); | ||||
| @@ -293,7 +293,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_doubles_equal(roots1[2], -1, 1e-3); | lolunit_assert_doubles_equal(roots1[2], -1, 1e-3); | ||||
| } | } | ||||
| lolunit_declare_test(RootsDegree3SingleSolutions) | |||||
| lolunit_declare_test(degree_3_three_roots) | |||||
| { | { | ||||
| polynomial<float> p { 6.f, 11.f, 6.f, 1.f }; | polynomial<float> p { 6.f, 11.f, 6.f, 1.f }; | ||||
| auto roots1 = p.roots(); | auto roots1 = p.roots(); | ||||
| @@ -304,7 +304,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_doubles_equal(roots1[2], -2, 1e-8); | lolunit_assert_doubles_equal(roots1[2], -2, 1e-8); | ||||
| } | } | ||||
| lolunit_declare_test(RootsDegree3BiggerSolutions) | |||||
| lolunit_declare_test(degree_3_three_large_roots) | |||||
| { | { | ||||
| polynomial<float> p { -12000.f, 1000.f - 1200.f - 120.f, 100.f + 10.0f - 12.f, 1.f }; | polynomial<float> p { -12000.f, 1000.f - 1200.f - 120.f, 100.f + 10.0f - 12.f, 1.f }; | ||||
| auto roots1 = p.roots(); | auto roots1 = p.roots(); | ||||
| @@ -316,7 +316,7 @@ lolunit_declare_fixture(PolynomialTest) | |||||
| lolunit_assert_doubles_equal(roots1[2], -10, 1e-5); | lolunit_assert_doubles_equal(roots1[2], -10, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(Chebyshev) | |||||
| lolunit_declare_test(chebyshev) | |||||
| { | { | ||||
| polynomial<float> t0 = polynomial<float>::chebyshev(0); | polynomial<float> t0 = polynomial<float>::chebyshev(0); | ||||
| polynomial<float> t1 = polynomial<float>::chebyshev(1); | polynomial<float> t1 = polynomial<float>::chebyshev(1); | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,9 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_declare_fixture(quaternion_test) | |||||
| { | { | ||||
| void SetUp() | |||||
| void setup() | |||||
| { | { | ||||
| /* Generate identity quaternions */ | /* Generate identity quaternions */ | ||||
| m_vectorpairs.push(vec3::axis_x, vec3::axis_x); | m_vectorpairs.push(vec3::axis_x, vec3::axis_x); | ||||
| @@ -44,9 +44,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| } | } | ||||
| } | } | ||||
| void TearDown() {} | |||||
| lolunit_declare_test(Equality) | |||||
| lolunit_declare_test(equality) | |||||
| { | { | ||||
| quat a4(1.f, 2.f, 3.f, 4.f); | quat a4(1.f, 2.f, 3.f, 4.f); | ||||
| quat b4(0.f, 2.f, 3.f, 4.f); | quat b4(0.f, 2.f, 3.f, 4.f); | ||||
| @@ -55,19 +53,19 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| quat e4(1.f, 2.f, 3.f, 0.f); | quat e4(1.f, 2.f, 3.f, 0.f); | ||||
| lolunit_assert_equal(a4, a4); | lolunit_assert_equal(a4, a4); | ||||
| lolunit_assert_not_different(a4, a4); | |||||
| lolunit_refute_different(a4, a4); | |||||
| lolunit_assert_different(a4, b4); | lolunit_assert_different(a4, b4); | ||||
| lolunit_assert_not_equal(a4, b4); | |||||
| lolunit_refute_equal(a4, b4); | |||||
| lolunit_assert_different(a4, c4); | lolunit_assert_different(a4, c4); | ||||
| lolunit_assert_not_equal(a4, c4); | |||||
| lolunit_refute_equal(a4, c4); | |||||
| lolunit_assert_different(a4, d4); | lolunit_assert_different(a4, d4); | ||||
| lolunit_assert_not_equal(a4, d4); | |||||
| lolunit_refute_equal(a4, d4); | |||||
| lolunit_assert_different(a4, e4); | lolunit_assert_different(a4, e4); | ||||
| lolunit_assert_not_equal(a4, e4); | |||||
| lolunit_refute_equal(a4, e4); | |||||
| } | } | ||||
| lolunit_declare_test(UnaryMinus) | |||||
| lolunit_declare_test(unary_minus) | |||||
| { | { | ||||
| quat a(1.f, 3.f, 2.f, 4.f); | quat a(1.f, 3.f, 2.f, 4.f); | ||||
| quat b(-1.f, -3.f, -2.f, -4.f); | quat b(-1.f, -3.f, -2.f, -4.f); | ||||
| @@ -76,7 +74,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_equal(-a, b); | lolunit_assert_equal(-a, b); | ||||
| } | } | ||||
| lolunit_declare_test(Conjugate) | |||||
| lolunit_declare_test(conjugate) | |||||
| { | { | ||||
| quat a(1.f, 3.f, 2.f, 4.f); | quat a(1.f, 3.f, 2.f, 4.f); | ||||
| quat b(1.f, -3.f, -2.f, -4.f); | quat b(1.f, -3.f, -2.f, -4.f); | ||||
| @@ -85,7 +83,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_equal(~a, b); | lolunit_assert_equal(~a, b); | ||||
| } | } | ||||
| lolunit_declare_test(Norm) | |||||
| lolunit_declare_test(quaternion_norm) | |||||
| { | { | ||||
| quat a(2.f, -2.f, -8.f, 3.f); | quat a(2.f, -2.f, -8.f, 3.f); | ||||
| @@ -101,7 +99,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_equal(norm(a * d), norm(a) * norm(d)); | lolunit_assert_equal(norm(a * d), norm(a) * norm(d)); | ||||
| } | } | ||||
| lolunit_declare_test(Dot) | |||||
| lolunit_declare_test(quaternion_dot) | |||||
| { | { | ||||
| quat a(-1.f, 2.f, -3.f, 4.f); | quat a(-1.f, 2.f, -3.f, 4.f); | ||||
| quat b(8.f, 7.f, 6.f, 5.f); | quat b(8.f, 7.f, 6.f, 5.f); | ||||
| @@ -109,7 +107,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_equal(dot(a, b), 8.f); | lolunit_assert_equal(dot(a, b), 8.f); | ||||
| } | } | ||||
| lolunit_declare_test(Base) | |||||
| lolunit_declare_test(base) | |||||
| { | { | ||||
| quat one(1.f, 0.f, 0.f, 0.f); | quat one(1.f, 0.f, 0.f, 0.f); | ||||
| quat i(0.f, 1.f, 0.f, 0.f); | quat i(0.f, 1.f, 0.f, 0.f); | ||||
| @@ -134,7 +132,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_equal(i * k, -j); | lolunit_assert_equal(i * k, -j); | ||||
| } | } | ||||
| lolunit_declare_test(Normalize) | |||||
| lolunit_declare_test(quaternion_normalize) | |||||
| { | { | ||||
| quat a(2.f, -2.f, -8.f, 3.f); | quat a(2.f, -2.f, -8.f, 3.f); | ||||
| quat b = normalize(a); | quat b = normalize(a); | ||||
| @@ -142,7 +140,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_doubles_equal(norm(b), 1.0, 1e-5); | lolunit_assert_doubles_equal(norm(b), 1.0, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(Reciprocal) | |||||
| lolunit_declare_test(reciprocal) | |||||
| { | { | ||||
| quat a(2.f, -2.f, -8.f, 3.f); | quat a(2.f, -2.f, -8.f, 3.f); | ||||
| quat b = re(a); | quat b = re(a); | ||||
| @@ -166,7 +164,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_doubles_equal(m1.z, 0.0, 1e-5); | lolunit_assert_doubles_equal(m1.z, 0.0, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(Rotation) | |||||
| lolunit_declare_test(rotation) | |||||
| { | { | ||||
| /* Check that rotating 10 degrees twice means rotating 20 degrees */ | /* Check that rotating 10 degrees twice means rotating 20 degrees */ | ||||
| quat a = quat::rotate(10.f, vec3::axis_x); | quat a = quat::rotate(10.f, vec3::axis_x); | ||||
| @@ -188,7 +186,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_doubles_equal(e.z, d.z, 1e-5); | lolunit_assert_doubles_equal(e.z, d.z, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(ToAxisAngle) | |||||
| lolunit_declare_test(to_axis_angle) | |||||
| { | { | ||||
| quat q = quat::rotate(10.f, vec3::axis_x); | quat q = quat::rotate(10.f, vec3::axis_x); | ||||
| vec3 axis = q.axis(); | vec3 axis = q.axis(); | ||||
| @@ -201,7 +199,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| lolunit_assert_doubles_equal(10.0, (double)degrees(angle), 1e-6); | lolunit_assert_doubles_equal(10.0, (double)degrees(angle), 1e-6); | ||||
| } | } | ||||
| lolunit_declare_test(FromTwoVectors) | |||||
| lolunit_declare_test(from_two_vectors) | |||||
| { | { | ||||
| for (auto pair : m_vectorpairs) | for (auto pair : m_vectorpairs) | ||||
| { | { | ||||
| @@ -246,7 +244,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(FromEulerNorm) | |||||
| lolunit_declare_test(from_euler_norm) | |||||
| { | { | ||||
| for (int i = 0; i < 100; ++i) | for (int i = 0; i < 100; ++i) | ||||
| { | { | ||||
| @@ -292,7 +290,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(FirstTwoEulerAngles) | |||||
| lolunit_declare_test(first_two_euler_angles) | |||||
| { | { | ||||
| for (int i = 0; i < 100; ++i) | for (int i = 0; i < 100; ++i) | ||||
| { | { | ||||
| @@ -351,7 +349,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(LastTwoEulerAngles) | |||||
| lolunit_declare_test(last_two_euler_angles) | |||||
| { | { | ||||
| for (int i = 0; i < 100; ++i) | for (int i = 0; i < 100; ++i) | ||||
| { | { | ||||
| @@ -410,7 +408,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(TaitBryanAngles) | |||||
| lolunit_declare_test(tait_bryan_angles) | |||||
| { | { | ||||
| for (int i = 0; i < 100; ++i) | for (int i = 0; i < 100; ++i) | ||||
| { | { | ||||
| @@ -472,7 +470,7 @@ lolunit_declare_fixture(QuaternionTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(EulerAngles) | |||||
| lolunit_declare_test(euler_angles) | |||||
| { | { | ||||
| for (int i = 0; i < 100; ++i) | for (int i = 0; i < 100; ++i) | ||||
| { | { | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,13 +17,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(RandTest) | |||||
| lolunit_declare_fixture(rand_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(Int32Bits) | |||||
| lolunit_declare_test(int32_bits) | |||||
| { | { | ||||
| int const rolls = 2000; | int const rolls = 2000; | ||||
| @@ -52,7 +48,7 @@ lolunit_declare_fixture(RandTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(Int16Bits) | |||||
| lolunit_declare_test(int16_bits) | |||||
| { | { | ||||
| int const rolls = 2000; | int const rolls = 2000; | ||||
| @@ -81,7 +77,7 @@ lolunit_declare_fixture(RandTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(Int8Bits) | |||||
| lolunit_declare_test(int8_bits) | |||||
| { | { | ||||
| int const rolls = 2000; | int const rolls = 2000; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -19,9 +19,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(RealTest) | |||||
| lolunit_declare_fixture(real_test) | |||||
| { | { | ||||
| lolunit_declare_test(Constants) | |||||
| lolunit_declare_test(constants) | |||||
| { | { | ||||
| double a0 = real::R_0(); | double a0 = real::R_0(); | ||||
| double a1 = real::R_1(); | double a1 = real::R_1(); | ||||
| @@ -68,7 +68,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_equal(i2, 0.5); | lolunit_assert_equal(i2, 0.5); | ||||
| } | } | ||||
| lolunit_declare_test(FloatToReal) | |||||
| lolunit_declare_test(float_to_real) | |||||
| { | { | ||||
| float a1 = real(0.0f); | float a1 = real(0.0f); | ||||
| float a2 = real(-0.0f); | float a2 = real(-0.0f); | ||||
| @@ -85,7 +85,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_equal(a6, 12345678.0f); | lolunit_assert_equal(a6, 12345678.0f); | ||||
| } | } | ||||
| lolunit_declare_test(DoubleToReal) | |||||
| lolunit_declare_test(double_to_real) | |||||
| { | { | ||||
| double a1 = real(0.0); | double a1 = real(0.0); | ||||
| double a2 = real(-0.0); | double a2 = real(-0.0); | ||||
| @@ -102,7 +102,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_doubles_equal(a6, 1234567876543210.0, 0.0); | lolunit_assert_doubles_equal(a6, 1234567876543210.0, 0.0); | ||||
| } | } | ||||
| lolunit_declare_test(Init) | |||||
| lolunit_declare_test(init) | |||||
| { | { | ||||
| real r; | real r; | ||||
| float f1 = (float)r; | float f1 = (float)r; | ||||
| @@ -117,7 +117,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_equal(f3, 0.0f); | lolunit_assert_equal(f3, 0.0f); | ||||
| } | } | ||||
| lolunit_declare_test(StringToReal) | |||||
| lolunit_declare_test(string_to_real) | |||||
| { | { | ||||
| float a1 = real("0"); | float a1 = real("0"); | ||||
| float a2 = real("1"); | float a2 = real("1"); | ||||
| @@ -134,7 +134,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_equal(a4, 1.0f); | lolunit_assert_equal(a4, 1.0f); | ||||
| } | } | ||||
| lolunit_declare_test(UnaryMinus) | |||||
| lolunit_declare_test(unary_minus) | |||||
| { | { | ||||
| float a1 = - real(1.0f); | float a1 = - real(1.0f); | ||||
| float a2 = - real(-1.0f); | float a2 = - real(-1.0f); | ||||
| @@ -147,7 +147,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_equal(a4, 0.0f); | lolunit_assert_equal(a4, 0.0f); | ||||
| } | } | ||||
| lolunit_declare_test(Comparison) | |||||
| lolunit_declare_test(comparison) | |||||
| { | { | ||||
| lolunit_assert(real(1.0f) > real(0.5f)); | lolunit_assert(real(1.0f) > real(0.5f)); | ||||
| lolunit_assert(real(1.0f) >= real(0.5f)); | lolunit_assert(real(1.0f) >= real(0.5f)); | ||||
| @@ -168,7 +168,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert(real(0.5f) >= real(-1.0f)); | lolunit_assert(real(0.5f) >= real(-1.0f)); | ||||
| } | } | ||||
| lolunit_declare_test(Addition) | |||||
| lolunit_declare_test(addition) | |||||
| { | { | ||||
| float a1 = real(1.0f) + real(0.0f); | float a1 = real(1.0f) + real(0.0f); | ||||
| float a2 = real(0.0f) + real(1.0f); | float a2 = real(0.0f) + real(1.0f); | ||||
| @@ -190,14 +190,14 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_doubles_equal(a8, 0.1, 1.0e-13); | lolunit_assert_doubles_equal(a8, 0.1, 1.0e-13); | ||||
| } | } | ||||
| lolunit_declare_test(Subtraction) | |||||
| lolunit_declare_test(subtraction) | |||||
| { | { | ||||
| float a1 = real(1.0f) + real(1e20f) - real(1e20f); | float a1 = real(1.0f) + real(1e20f) - real(1e20f); | ||||
| lolunit_assert_equal(a1, 1.0f); | lolunit_assert_equal(a1, 1.0f); | ||||
| } | } | ||||
| lolunit_declare_test(Multiplication) | |||||
| lolunit_declare_test(multiplication) | |||||
| { | { | ||||
| real x(1.25f); | real x(1.25f); | ||||
| real y(1.5f); | real y(1.5f); | ||||
| @@ -215,7 +215,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_equal(m4, -1.5f * -1.5f); | lolunit_assert_equal(m4, -1.5f * -1.5f); | ||||
| } | } | ||||
| lolunit_declare_test(ExactDivision) | |||||
| lolunit_declare_test(exact_division) | |||||
| { | { | ||||
| float m1 = real::R_1() / real::R_1(); | float m1 = real::R_1() / real::R_1(); | ||||
| float m2 = real::R_2() / real::R_1(); | float m2 = real::R_2() / real::R_1(); | ||||
| @@ -230,7 +230,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_equal(m5, -0.5f); | lolunit_assert_equal(m5, -0.5f); | ||||
| } | } | ||||
| lolunit_declare_test(InexactDivision) | |||||
| lolunit_declare_test(inexact_division) | |||||
| { | { | ||||
| /* 1 / 3 * 3 should be close to 1... check that it does not differ | /* 1 / 3 * 3 should be close to 1... check that it does not differ | ||||
| * by more than 2^-k where k is the number of bits in the mantissa. */ | * by more than 2^-k where k is the number of bits in the mantissa. */ | ||||
| @@ -240,7 +240,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_lequal((double)fabs(b), 1.0); | lolunit_assert_lequal((double)fabs(b), 1.0); | ||||
| } | } | ||||
| lolunit_declare_test(LoadExp) | |||||
| lolunit_declare_test(real_ldexp) | |||||
| { | { | ||||
| real a1(1.5); | real a1(1.5); | ||||
| real a2(-1.5); | real a2(-1.5); | ||||
| @@ -256,15 +256,15 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert_equal((double)ldexp(a3, -7), 0.0); | lolunit_assert_equal((double)ldexp(a3, -7), 0.0); | ||||
| } | } | ||||
| lolunit_declare_test(Ulp) | |||||
| lolunit_declare_test(real_ulp) | |||||
| { | { | ||||
| real a1 = real::R_PI(); | real a1 = real::R_PI(); | ||||
| lolunit_assert_not_equal((double)(a1 + ulp(a1) - a1), 0.0); | |||||
| lolunit_refute_equal((double)(a1 + ulp(a1) - a1), 0.0); | |||||
| lolunit_assert_equal((double)(a1 + ulp(a1) / 2 - a1), 0.0); | lolunit_assert_equal((double)(a1 + ulp(a1) / 2 - a1), 0.0); | ||||
| } | } | ||||
| lolunit_declare_test(Bool) | |||||
| lolunit_declare_test(real_bool) | |||||
| { | { | ||||
| real a = 0.0; | real a = 0.0; | ||||
| lolunit_assert(!a); | lolunit_assert(!a); | ||||
| @@ -281,7 +281,7 @@ lolunit_declare_fixture(RealTest) | |||||
| lolunit_assert(!!a); | lolunit_assert(!!a); | ||||
| } | } | ||||
| lolunit_declare_test(AsinAcos) | |||||
| lolunit_declare_test(real_asin_acos) | |||||
| { | { | ||||
| double tests[] = | double tests[] = | ||||
| { | { | ||||
| @@ -301,7 +301,7 @@ lolunit_declare_fixture(RealTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(FloorCeilEtc) | |||||
| lolunit_declare_test(floor_ceil_etc) | |||||
| { | { | ||||
| double tests[] = | double tests[] = | ||||
| { | { | ||||
| @@ -343,7 +343,7 @@ lolunit_declare_fixture(RealTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(Pow) | |||||
| lolunit_declare_test(real_pow) | |||||
| { | { | ||||
| double a1 = pow(-real::R_2(), real::R_2()); | double a1 = pow(-real::R_2(), real::R_2()); | ||||
| double b1 = 4.0; | double b1 = 4.0; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,13 +17,13 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(RotationTest) | |||||
| lolunit_declare_fixture(rotation_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void setup() {} | |||||
| void TearDown() {} | |||||
| void teardown() {} | |||||
| lolunit_declare_test(Rotate2D) | |||||
| lolunit_declare_test(rotate_2d) | |||||
| { | { | ||||
| /* Rotations must be CCW */ | /* Rotations must be CCW */ | ||||
| mat2 m90 = mat2::rotate(90.f); | mat2 m90 = mat2::rotate(90.f); | ||||
| @@ -39,7 +39,7 @@ lolunit_declare_fixture(RotationTest) | |||||
| lolunit_assert_doubles_equal(d, 1.0, 1e-5); | lolunit_assert_doubles_equal(d, 1.0, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(Compose2D) | |||||
| lolunit_declare_test(compose_2d) | |||||
| { | { | ||||
| /* Rotating 20 degrees twice must equal rotating 40 degrees */ | /* Rotating 20 degrees twice must equal rotating 40 degrees */ | ||||
| mat2 m20 = mat2::rotate(20.f); | mat2 m20 = mat2::rotate(20.f); | ||||
| @@ -53,7 +53,7 @@ lolunit_declare_fixture(RotationTest) | |||||
| lolunit_assert_doubles_equal(m20x20[1][1], m40[1][1], 1e-5); | lolunit_assert_doubles_equal(m20x20[1][1], m40[1][1], 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(Rotate3D) | |||||
| lolunit_declare_test(rotate_3d) | |||||
| { | { | ||||
| /* Rotations must be CCW along each axis */ | /* Rotations must be CCW along each axis */ | ||||
| mat3 m90x = mat3::rotate(90.f, 1.f, 0.f, 0.f); | mat3 m90x = mat3::rotate(90.f, 1.f, 0.f, 0.f); | ||||
| @@ -86,7 +86,7 @@ lolunit_declare_fixture(RotationTest) | |||||
| lolunit_assert_doubles_equal(dz, 1.0, 1e-5); | lolunit_assert_doubles_equal(dz, 1.0, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(Compose3D) | |||||
| lolunit_declare_test(compose_3d) | |||||
| { | { | ||||
| /* Rotating 20 degrees twice must equal rotating 40 degrees */ | /* Rotating 20 degrees twice must equal rotating 40 degrees */ | ||||
| mat3 m20 = mat3::rotate(20.f, 1.f, 2.f, 3.f); | mat3 m20 = mat3::rotate(20.f, 1.f, 2.f, 3.f); | ||||
| @@ -106,7 +106,7 @@ lolunit_declare_fixture(RotationTest) | |||||
| lolunit_assert_doubles_equal(m20x20[2][2], m40[2][2], 1e-5); | lolunit_assert_doubles_equal(m20x20[2][2], m40[2][2], 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(QuaternionTransform) | |||||
| lolunit_declare_test(quaternion_transform) | |||||
| { | { | ||||
| /* Rotating using a quaternion must equal rotating using a matrix */ | /* Rotating using a quaternion must equal rotating using a matrix */ | ||||
| mat3 m20 = mat3::rotate(20.f, 1.f, 2.f, 3.f); | mat3 m20 = mat3::rotate(20.f, 1.f, 2.f, 3.f); | ||||
| @@ -125,7 +125,7 @@ lolunit_declare_fixture(RotationTest) | |||||
| lolunit_assert_doubles_equal(n, 1.0, 1e-5); | lolunit_assert_doubles_equal(n, 1.0, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(QuaternionFromMatrix) | |||||
| lolunit_declare_test(quaternion_from_matrix) | |||||
| { | { | ||||
| /* A rotation matrix converted to a quaternion should match the | /* A rotation matrix converted to a quaternion should match the | ||||
| * quaternion built with the same parameters */ | * quaternion built with the same parameters */ | ||||
| @@ -144,7 +144,7 @@ lolunit_declare_fixture(RotationTest) | |||||
| lolunit_assert_doubles_equal(n2, 1.0, 1e-5); | lolunit_assert_doubles_equal(n2, 1.0, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(MatrixFromQuaternion) | |||||
| lolunit_declare_test(matrix_from_quaternion) | |||||
| { | { | ||||
| /* A quaternion converted to a rotation matrix should match the | /* A quaternion converted to a rotation matrix should match the | ||||
| * rotation matrix built with the same parameters */ | * rotation matrix built with the same parameters */ | ||||
| @@ -170,7 +170,7 @@ lolunit_declare_fixture(RotationTest) | |||||
| lolunit_assert_doubles_equal(d2, 1.0, 1e-5); | lolunit_assert_doubles_equal(d2, 1.0, 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(MatrixCompositionThroughQuaternions) | |||||
| lolunit_declare_test(matrix_composition_through_quaternions) | |||||
| { | { | ||||
| /* Combining two rotation matrices should match the matrix created | /* Combining two rotation matrices should match the matrix created | ||||
| * from the combination of the two equivalent quaternions */ | * from the combination of the two equivalent quaternions */ | ||||
| @@ -193,7 +193,7 @@ lolunit_declare_fixture(RotationTest) | |||||
| lolunit_assert_doubles_equal(m4[2][2], m3[2][2], 1e-5); | lolunit_assert_doubles_equal(m4[2][2], m3[2][2], 1e-5); | ||||
| } | } | ||||
| lolunit_declare_test(QuaternionCompositionThroughMatrices) | |||||
| lolunit_declare_test(quaternion_composition_through_matrices) | |||||
| { | { | ||||
| /* Combining two quaternions should match the quaternion created | /* Combining two quaternions should match the quaternion created | ||||
| * from the combination of the two equivalent rotation matrices */ | * from the combination of the two equivalent rotation matrices */ | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -19,9 +19,9 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(TrigTest) | |||||
| lolunit_declare_fixture(trig_test) | |||||
| { | { | ||||
| lolunit_declare_test(AngleConversions) | |||||
| lolunit_declare_test(angle_conversions) | |||||
| { | { | ||||
| lolunit_assert_doubles_equal(D_PI, radians(180.0), 1e-5); | lolunit_assert_doubles_equal(D_PI, radians(180.0), 1e-5); | ||||
| lolunit_assert_doubles_equal(D_PI_2, radians(90.0), 1e-5); | lolunit_assert_doubles_equal(D_PI_2, radians(90.0), 1e-5); | ||||
| @@ -36,7 +36,7 @@ lolunit_declare_fixture(TrigTest) | |||||
| lolunit_assert_doubles_equal(90.0f, degrees(F_PI_2), 1e-5f); | lolunit_assert_doubles_equal(90.0f, degrees(F_PI_2), 1e-5f); | ||||
| } | } | ||||
| lolunit_declare_test(Sin) | |||||
| lolunit_declare_test(sin) | |||||
| { | { | ||||
| using std::fabs; | using std::fabs; | ||||
| @@ -67,7 +67,7 @@ lolunit_declare_fixture(TrigTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(Cos) | |||||
| lolunit_declare_test(cos) | |||||
| { | { | ||||
| using std::fabs; | using std::fabs; | ||||
| @@ -98,7 +98,7 @@ lolunit_declare_fixture(TrigTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(SinCos) | |||||
| lolunit_declare_test(sin_cos) | |||||
| { | { | ||||
| using std::fabs; | using std::fabs; | ||||
| @@ -137,7 +137,7 @@ lolunit_declare_fixture(TrigTest) | |||||
| } | } | ||||
| } | } | ||||
| lolunit_declare_test(Tan) | |||||
| lolunit_declare_test(tan) | |||||
| { | { | ||||
| using std::fabs; | using std::fabs; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -17,25 +17,21 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| lolunit_declare_fixture(VectorTest) | |||||
| lolunit_declare_fixture(vector_test) | |||||
| { | { | ||||
| void SetUp() {} | |||||
| void TearDown() {} | |||||
| lolunit_declare_test(VectorEquality) | |||||
| lolunit_declare_test(vector_equality) | |||||
| { | { | ||||
| vec2 a2(1.0f, 2.0f); | vec2 a2(1.0f, 2.0f); | ||||
| vec2 b2(0.0f, 2.0f); | vec2 b2(0.0f, 2.0f); | ||||
| vec2 c2(1.0f, 0.0f); | vec2 c2(1.0f, 0.0f); | ||||
| lolunit_assert_equal(a2, a2); | lolunit_assert_equal(a2, a2); | ||||
| lolunit_assert_not_different(a2, a2); | |||||
| lolunit_refute_different(a2, a2); | |||||
| lolunit_assert_different(a2, b2); | lolunit_assert_different(a2, b2); | ||||
| lolunit_assert_not_equal(a2, b2); | |||||
| lolunit_refute_equal(a2, b2); | |||||
| lolunit_assert_different(a2, c2); | lolunit_assert_different(a2, c2); | ||||
| lolunit_assert_not_equal(a2, c2); | |||||
| lolunit_refute_equal(a2, c2); | |||||
| vec3 a3(1.0f, 2.0f, 3.0f); | vec3 a3(1.0f, 2.0f, 3.0f); | ||||
| vec3 b3(0.0f, 2.0f, 3.0f); | vec3 b3(0.0f, 2.0f, 3.0f); | ||||
| @@ -43,14 +39,14 @@ lolunit_declare_fixture(VectorTest) | |||||
| vec3 d3(1.0f, 2.0f, 0.0f); | vec3 d3(1.0f, 2.0f, 0.0f); | ||||
| lolunit_assert_equal(a3, a3); | lolunit_assert_equal(a3, a3); | ||||
| lolunit_assert_not_different(a3, a3); | |||||
| lolunit_refute_different(a3, a3); | |||||
| lolunit_assert_different(a3, b3); | lolunit_assert_different(a3, b3); | ||||
| lolunit_assert_not_equal(a3, b3); | |||||
| lolunit_refute_equal(a3, b3); | |||||
| lolunit_assert_different(a3, c3); | lolunit_assert_different(a3, c3); | ||||
| lolunit_assert_not_equal(a3, c3); | |||||
| lolunit_refute_equal(a3, c3); | |||||
| lolunit_assert_different(a3, d3); | lolunit_assert_different(a3, d3); | ||||
| lolunit_assert_not_equal(a3, d3); | |||||
| lolunit_refute_equal(a3, d3); | |||||
| vec4 a4(1.0f, 2.0f, 3.0f, 4.0f); | vec4 a4(1.0f, 2.0f, 3.0f, 4.0f); | ||||
| vec4 b4(0.0f, 2.0f, 3.0f, 4.0f); | vec4 b4(0.0f, 2.0f, 3.0f, 4.0f); | ||||
| @@ -59,19 +55,19 @@ lolunit_declare_fixture(VectorTest) | |||||
| vec4 e4(1.0f, 2.0f, 3.0f, 0.0f); | vec4 e4(1.0f, 2.0f, 3.0f, 0.0f); | ||||
| lolunit_assert_equal(a4, a4); | lolunit_assert_equal(a4, a4); | ||||
| lolunit_assert_not_different(a4, a4); | |||||
| lolunit_refute_different(a4, a4); | |||||
| lolunit_assert_different(a4, b4); | lolunit_assert_different(a4, b4); | ||||
| lolunit_assert_not_equal(a4, b4); | |||||
| lolunit_refute_equal(a4, b4); | |||||
| lolunit_assert_different(a4, c4); | lolunit_assert_different(a4, c4); | ||||
| lolunit_assert_not_equal(a4, c4); | |||||
| lolunit_refute_equal(a4, c4); | |||||
| lolunit_assert_different(a4, d4); | lolunit_assert_different(a4, d4); | ||||
| lolunit_assert_not_equal(a4, d4); | |||||
| lolunit_refute_equal(a4, d4); | |||||
| lolunit_assert_different(a4, e4); | lolunit_assert_different(a4, e4); | ||||
| lolunit_assert_not_equal(a4, e4); | |||||
| lolunit_refute_equal(a4, e4); | |||||
| } | } | ||||
| lolunit_declare_test(VectorInequality) | |||||
| lolunit_declare_test(vector_inequality) | |||||
| { | { | ||||
| vec2 a2(1.0f, 3.0f); | vec2 a2(1.0f, 3.0f); | ||||
| vec2 b2(0.0f, 0.0f); | vec2 b2(0.0f, 0.0f); | ||||
| @@ -81,21 +77,21 @@ lolunit_declare_fixture(VectorTest) | |||||
| vec2 f2(4.0f, 4.0f); | vec2 f2(4.0f, 4.0f); | ||||
| lolunit_assert_lequal(a2, a2); | lolunit_assert_lequal(a2, a2); | ||||
| lolunit_assert_not_less(a2, a2); | |||||
| lolunit_assert_not_lequal(a2, b2); | |||||
| lolunit_assert_not_less(a2, b2); | |||||
| lolunit_assert_not_lequal(a2, c2); | |||||
| lolunit_assert_not_less(a2, c2); | |||||
| lolunit_assert_not_lequal(a2, d2); | |||||
| lolunit_assert_not_less(a2, d2); | |||||
| lolunit_refute_less(a2, a2); | |||||
| lolunit_refute_lequal(a2, b2); | |||||
| lolunit_refute_less(a2, b2); | |||||
| lolunit_refute_lequal(a2, c2); | |||||
| lolunit_refute_less(a2, c2); | |||||
| lolunit_refute_lequal(a2, d2); | |||||
| lolunit_refute_less(a2, d2); | |||||
| lolunit_assert_lequal(a2, e2); | lolunit_assert_lequal(a2, e2); | ||||
| lolunit_assert_not_less(a2, e2); | |||||
| lolunit_refute_less(a2, e2); | |||||
| lolunit_assert_lequal(a2, f2); | lolunit_assert_lequal(a2, f2); | ||||
| lolunit_assert_less(a2, f2); | lolunit_assert_less(a2, f2); | ||||
| } | } | ||||
| lolunit_declare_test(VectorInit) | |||||
| lolunit_declare_test(vector_init) | |||||
| { | { | ||||
| vec2 a { 1.f, 2.f }; | vec2 a { 1.f, 2.f }; | ||||
| lolunit_assert_equal(1.f, a.x); | lolunit_assert_equal(1.f, a.x); | ||||
| @@ -125,7 +121,7 @@ lolunit_declare_fixture(VectorTest) | |||||
| lolunit_assert_equal(0.f, d[9]); | lolunit_assert_equal(0.f, d[9]); | ||||
| } | } | ||||
| lolunit_declare_test(VectorSwizzle) | |||||
| lolunit_declare_test(vector_swizzle) | |||||
| { | { | ||||
| vec3 a(1.0f, 2.0f, 3.0f); | vec3 a(1.0f, 2.0f, 3.0f); | ||||
| vec3 b(4.0f, 5.0f, 6.0f); | vec3 b(4.0f, 5.0f, 6.0f); | ||||
| @@ -175,7 +171,7 @@ lolunit_declare_fixture(VectorTest) | |||||
| #endif | #endif | ||||
| } | } | ||||
| lolunit_declare_test(VectorSwizzleMul) | |||||
| lolunit_declare_test(vector_swizzle_mul) | |||||
| { | { | ||||
| ivec3 a(1, 2, 3); | ivec3 a(1, 2, 3); | ||||
| @@ -205,7 +201,7 @@ lolunit_declare_fixture(VectorTest) | |||||
| lolunit_assert_equal(f.z, 2); | lolunit_assert_equal(f.z, 2); | ||||
| } | } | ||||
| lolunit_declare_test(VectorUnaryMinus) | |||||
| lolunit_declare_test(vector_unary_minus) | |||||
| { | { | ||||
| vec2 a(1.0f, 3.0f); | vec2 a(1.0f, 3.0f); | ||||
| vec2 b(-1.0f, -3.0f); | vec2 b(-1.0f, -3.0f); | ||||
| @@ -214,7 +210,7 @@ lolunit_declare_fixture(VectorTest) | |||||
| lolunit_assert_equal(-a, b); | lolunit_assert_equal(-a, b); | ||||
| } | } | ||||
| lolunit_declare_test(CastVector) | |||||
| lolunit_declare_test(cast_vector) | |||||
| { | { | ||||
| vec2 a1(1.0f, 3.0f); | vec2 a1(1.0f, 3.0f); | ||||
| @@ -234,7 +230,7 @@ lolunit_declare_fixture(VectorTest) | |||||
| lolunit_assert_equal(a3, a1); | lolunit_assert_equal(a3, a1); | ||||
| } | } | ||||
| lolunit_declare_test(Orthogonal) | |||||
| lolunit_declare_test(vector_orthogonal) | |||||
| { | { | ||||
| vec3 a(1.f, 0.f, 0.f); | vec3 a(1.f, 0.f, 0.f); | ||||
| vec3 b(0.f, 1.f, 0.f); | vec3 b(0.f, 1.f, 0.f); | ||||
| @@ -260,7 +256,7 @@ lolunit_declare_fixture(VectorTest) | |||||
| lolunit_assert_doubles_equal(length(orthonormal(c)), 1.f, 1e-6f); | lolunit_assert_doubles_equal(length(orthonormal(c)), 1.f, 1e-6f); | ||||
| } | } | ||||
| lolunit_declare_test(LargeVectors) | |||||
| lolunit_declare_test(large_vectors) | |||||
| { | { | ||||
| vec_t<int, 50> v0(0); | vec_t<int, 50> v0(0); | ||||
| vec_t<int, 50> v1(1); | vec_t<int, 50> v1(1); | ||||
| @@ -273,7 +269,7 @@ lolunit_declare_fixture(VectorTest) | |||||
| } | } | ||||
| #if !LOL_FEATURE_VISUAL_STUDIO_THAT_FUCKING_PIECE_OF_SHIT_COMPILER | #if !LOL_FEATURE_VISUAL_STUDIO_THAT_FUCKING_PIECE_OF_SHIT_COMPILER | ||||
| lolunit_declare_test(VectorIterator) | |||||
| lolunit_declare_test(vector_iterator) | |||||
| { | { | ||||
| vec4 v4(1.125f, 1.25f, 1.375f, 1.25f); | vec4 v4(1.125f, 1.25f, 1.375f, 1.25f); | ||||
| @@ -141,11 +141,11 @@ lolunit_declare_fixture(thread_test) | |||||
| }; | }; | ||||
| UnitTestThreadManager m_manager; | UnitTestThreadManager m_manager; | ||||
| void SetUp() | |||||
| void setup() | |||||
| { | { | ||||
| } | } | ||||
| void TearDown() | |||||
| void teardown() | |||||
| { | { | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine — Unit tests | // Lol Engine — Unit tests | ||||
| // | // | ||||
| // Copyright © 2010—2014 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // Lol Engine is free software. It comes without any warranty, to | // Lol Engine is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -21,7 +21,7 @@ int main(int argc, char **argv) | |||||
| { | { | ||||
| UNUSED(argc, argv); | UNUSED(argc, argv); | ||||
| lol::TextTestRunner runner; | |||||
| lol::text_runner runner; | |||||
| bool success = runner.Run(); | bool success = runner.Run(); | ||||
| return success ? EXIT_SUCCESS : EXIT_FAILURE; | return success ? EXIT_SUCCESS : EXIT_FAILURE; | ||||
| } | } | ||||
| @@ -1,9 +1,9 @@ | |||||
| // | // | ||||
| // Lol Engine | |||||
| // Lol Engine — Unit test implementation | |||||
| // | // | ||||
| // Copyright © 2010-2015 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | // | ||||
| // This library is free software. It comes without any warranty, to | |||||
| // Lol Engine is free software. It comes without any warranty, to | |||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| // and/or modify it under the terms of the Do What the Fuck You Want | // and/or modify it under the terms of the Do What the Fuck You Want | ||||
| // to Public License, Version 2, as published by the WTFPL Task Force. | // to Public License, Version 2, as published by the WTFPL Task Force. | ||||
| @@ -45,11 +45,11 @@ namespace lol | |||||
| */ | */ | ||||
| class FixtureBase | class FixtureBase | ||||
| { | { | ||||
| friend class TextTestRunner; | |||||
| friend class text_runner; | |||||
| public: | public: | ||||
| virtual void SetUp(void) {}; | |||||
| virtual void TearDown(void) {}; | |||||
| virtual void setup(void) {}; | |||||
| virtual void teardown(void) {}; | |||||
| protected: | protected: | ||||
| FixtureBase() : m_next(NULL), m_testcases(0), m_failcases(0) {} | FixtureBase() : m_next(NULL), m_testcases(0), m_failcases(0) {} | ||||
| @@ -199,7 +199,7 @@ private: | |||||
| * This simple class runs all automatically registered tests and reports | * This simple class runs all automatically registered tests and reports | ||||
| * on error and success in the standard output. | * on error and success in the standard output. | ||||
| */ | */ | ||||
| class TextTestRunner | |||||
| class text_runner | |||||
| { | { | ||||
| public: | public: | ||||
| bool Run() | bool Run() | ||||
| @@ -210,9 +210,9 @@ public: | |||||
| for (FixtureBase *f = FixtureBase::FixtureList(); f; f = f->m_next) | for (FixtureBase *f = FixtureBase::FixtureList(); f; f = f->m_next) | ||||
| { | { | ||||
| f->SetUp(); | |||||
| f->setup(); | |||||
| f->RunFixture(); | f->RunFixture(); | ||||
| f->TearDown(); | |||||
| f->teardown(); | |||||
| errors << f->m_errorlog.str(); | errors << f->m_errorlog.str(); | ||||
| testcases += f->m_testcases; | testcases += f->m_testcases; | ||||
| @@ -418,29 +418,29 @@ public: | |||||
| lolunit_assert_op(>=, (bool), "greater than or equal", make_msg(m), a, b) | lolunit_assert_op(>=, (bool), "greater than or equal", make_msg(m), a, b) | ||||
| #define lolunit_assert_not_equal(a, b) \ | |||||
| #define lolunit_refute_equal(a, b) \ | |||||
| lolunit_assert_op(==, !, "not equality", "", a, b) | lolunit_assert_op(==, !, "not equality", "", a, b) | ||||
| #define lolunit_assert_not_equal_message(m, a, b) \ | |||||
| #define lolunit_refute_equal_message(m, a, b) \ | |||||
| lolunit_assert_op(==, !, "not equality", make_msg(m), a, b) | lolunit_assert_op(==, !, "not equality", make_msg(m), a, b) | ||||
| #define lolunit_assert_not_different(a, b) \ | |||||
| #define lolunit_refute_different(a, b) \ | |||||
| lolunit_assert_op(!=, !, "not inequality", "", a, b) | lolunit_assert_op(!=, !, "not inequality", "", a, b) | ||||
| #define lolunit_assert_not_different_message(m, a, b) \ | |||||
| #define lolunit_refute_different_message(m, a, b) \ | |||||
| lolunit_assert_op(!=, !, "not inequality", make_msg(m), a, b) | lolunit_assert_op(!=, !, "not inequality", make_msg(m), a, b) | ||||
| #define lolunit_assert_not_less(a, b) \ | |||||
| #define lolunit_refute_less(a, b) \ | |||||
| lolunit_assert_op(<, !, "not less than", "", a, b) | lolunit_assert_op(<, !, "not less than", "", a, b) | ||||
| #define lolunit_assert_not_less_message(m, a, b) \ | |||||
| #define lolunit_refute_less_message(m, a, b) \ | |||||
| lolunit_assert_op(<, !, "not less than", make_msg(m), a, b) | lolunit_assert_op(<, !, "not less than", make_msg(m), a, b) | ||||
| #define lolunit_assert_not_lequal(a, b) \ | |||||
| #define lolunit_refute_lequal(a, b) \ | |||||
| lolunit_assert_op(<=, !, "not less than or equal", "", a, b) | lolunit_assert_op(<=, !, "not less than or equal", "", a, b) | ||||
| #define lolunit_assert_not_lequal_message(m, a, b) \ | |||||
| #define lolunit_refute_lequal_message(m, a, b) \ | |||||
| lolunit_assert_op(<=, !, "not less than or equal", make_msg(m), a, b) | lolunit_assert_op(<=, !, "not less than or equal", make_msg(m), a, b) | ||||
| #define lolunit_assert_not_greater(a, b) \ | |||||
| #define lolunit_refute_greater(a, b) \ | |||||
| lolunit_assert_op(>, !, "not greater than", "", a, b) | lolunit_assert_op(>, !, "not greater than", "", a, b) | ||||
| #define lolunit_assert_not_greater_message(m, a, b) \ | |||||
| #define lolunit_refute_greater_message(m, a, b) \ | |||||
| lolunit_assert_op(>, !, "not greater than", make_msg(m), a, b) | lolunit_assert_op(>, !, "not greater than", make_msg(m), a, b) | ||||
| #define lolunit_assert_not_gequal(a, b) \ | |||||
| #define lolunit_refute_gequal(a, b) \ | |||||
| lolunit_assert_op(>=, !, "not greater than or equal", "", a, b) | lolunit_assert_op(>=, !, "not greater than or equal", "", a, b) | ||||
| #define lolunit_assert_not_gequal_message(m, a, b) \ | |||||
| #define lolunit_refute_gequal_message(m, a, b) \ | |||||
| lolunit_assert_op(>=, !, "not greater than or equal", make_msg(m), a, b) | lolunit_assert_op(>=, !, "not greater than or equal", make_msg(m), a, b) | ||||
| #define lolunit_assert_doubles_equal(a, b, t) \ | #define lolunit_assert_doubles_equal(a, b, t) \ | ||||
| @@ -1,4 +1,4 @@ | |||||
| """ | |||||
| """ | |||||
| """ Experimental Lol Engine Vim plugin | """ Experimental Lol Engine Vim plugin | ||||
| """ | """ | ||||
| """ More info here: | """ More info here: | ||||
| @@ -49,7 +49,7 @@ au Syntax cpp | |||||
| " Unit testing | " Unit testing | ||||
| au Syntax cpp | au Syntax cpp | ||||
| \ syn match cOperator | \ syn match cOperator | ||||
| \ "\<lolunit_\(fail\|assert\)[a-z_]*\>" | |||||
| \ "\<lolunit_\(fail\|assert\|refute\)[a-z_]*\>" | |||||
| " Global keywords | " Global keywords | ||||
| au Syntax cpp | au Syntax cpp | ||||