From de2b1b77d52a0b582cb566baab009ad72c4cf97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 4 Sep 2012 21:42:21 +0200 Subject: [PATCH] Using Compare::Containers in primitive unit tests. --- src/Primitives/Test/CapsuleTest.cpp | 27 +++++++++++++++------------ src/Primitives/Test/UVSphereTest.cpp | 27 +++++++++++++++------------ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/Primitives/Test/CapsuleTest.cpp b/src/Primitives/Test/CapsuleTest.cpp index 03194016d..4e23ce175 100644 --- a/src/Primitives/Test/CapsuleTest.cpp +++ b/src/Primitives/Test/CapsuleTest.cpp @@ -16,11 +16,14 @@ /* Less precision */ #define FLOAT_EQUALITY_PRECISION 1.0e-5 +#include + #include "CapsuleTest.h" #include "Primitives/Capsule.h" using namespace std; +using Corrade::TestSuite::Compare::Container; CORRADE_TEST_MAIN(Magnum::Primitives::Test::CapsuleTest) @@ -34,7 +37,7 @@ CapsuleTest::CapsuleTest() { void CapsuleTest::withoutTextureCoords() { Capsule capsule(2, 3, 1.0f); - CORRADE_COMPARE(*capsule.positions(0), (vector{ + CORRADE_COMPARE_AS(*capsule.positions(0), (vector{ Vector4(0.0f, -1.5f, 0.0f), Vector4(0.0f, -1.20711f, 0.707107f), @@ -54,9 +57,9 @@ void CapsuleTest::withoutTextureCoords() { Vector4(-0.612372f, 1.20711f, -0.353553f), Vector4(0.0f, 1.5f, 0.0f) - })); + }), Container); - CORRADE_COMPARE(*capsule.normals(0), (vector{ + CORRADE_COMPARE_AS(*capsule.normals(0), (vector{ Vector3(0.0f, -1.0f, 0.0f), Vector3(0.0f, -0.707107f, 0.707107f), @@ -76,21 +79,21 @@ void CapsuleTest::withoutTextureCoords() { Vector3(-0.612372f, 0.707107f, -0.353553f), Vector3(0.0f, 1.0f, 0.0f) - })); + }), Container); - CORRADE_COMPARE(*capsule.indices(), (vector{ + CORRADE_COMPARE_AS(*capsule.indices(), (vector{ 0, 2, 1, 0, 3, 2, 0, 1, 3, 1, 2, 5, 1, 5, 4, 2, 3, 6, 2, 6, 5, 3, 1, 4, 3, 4, 6, 4, 5, 8, 4, 8, 7, 5, 6, 9, 5, 9, 8, 6, 4, 7, 6, 7, 9, 7, 8, 11, 7, 11, 10, 8, 9, 12, 8, 12, 11, 9, 7, 10, 9, 10, 12, 10, 11, 13, 11, 12, 13, 12, 10, 13 - })); + }), Container); } void CapsuleTest::withTextureCoords() { Capsule capsule(2, 3, 1.0f, Capsule::TextureCoords::Generate); - CORRADE_COMPARE(*capsule.positions(0), (vector{ + CORRADE_COMPARE_AS(*capsule.positions(0), (vector{ Vector4(0.0f, -1.5f, 0.0f), Vector4(0.0f, -1.20711f, 0.707107f), @@ -114,9 +117,9 @@ void CapsuleTest::withTextureCoords() { Vector4(0.0f, 1.20711f, 0.707107f), Vector4(0.0f, 1.5f, 0.0f) - })); + }), Container); - CORRADE_COMPARE(*capsule.textureCoords2D(0), (vector{ + CORRADE_COMPARE_AS(*capsule.textureCoords2D(0), (vector{ Vector2(0.5f, 0.0f), Vector2(0.0f, 0.166667f), @@ -140,15 +143,15 @@ void CapsuleTest::withTextureCoords() { Vector2(1.0f, 0.833333f), Vector2(0.5f, 1.0f) - })); + }), Container); - CORRADE_COMPARE(*capsule.indices(), (vector{ + CORRADE_COMPARE_AS(*capsule.indices(), (vector{ 0, 2, 1, 0, 3, 2, 0, 4, 3, 1, 2, 6, 1, 6, 5, 2, 3, 7, 2, 7, 6, 3, 4, 8, 3, 8, 7, 5, 6, 10, 5, 10, 9, 6, 7, 11, 6, 11, 10, 7, 8, 12, 7, 12, 11, 9, 10, 14, 9, 14, 13, 10, 11, 15, 10, 15, 14, 11, 12, 16, 11, 16, 15, 13, 14, 17, 14, 15, 17, 15, 16, 17 - })); + }), Container); } }}} diff --git a/src/Primitives/Test/UVSphereTest.cpp b/src/Primitives/Test/UVSphereTest.cpp index 091e508fe..71321865c 100644 --- a/src/Primitives/Test/UVSphereTest.cpp +++ b/src/Primitives/Test/UVSphereTest.cpp @@ -15,9 +15,12 @@ #include "UVSphereTest.h" +#include + #include "Primitives/UVSphere.h" using namespace std; +using Corrade::TestSuite::Compare::Container; CORRADE_TEST_MAIN(Magnum::Primitives::Test::UVSphereTest) @@ -31,7 +34,7 @@ UVSphereTest::UVSphereTest() { void UVSphereTest::withoutTextureCoords() { UVSphere sphere(3, 3); - CORRADE_COMPARE(*sphere.positions(0), (vector{ + CORRADE_COMPARE_AS(*sphere.positions(0), (vector{ Vector4(0.0f, -1.0f, 0.0f), Vector4(0.0f, -0.5f, 0.866025f), @@ -43,9 +46,9 @@ void UVSphereTest::withoutTextureCoords() { Vector4(-0.75f, 0.5f, -0.433013f), Vector4(0.0f, 1.0f, 0.0f) - })); + }), Container); - CORRADE_COMPARE(*sphere.normals(0), (vector{ + CORRADE_COMPARE_AS(*sphere.normals(0), (vector{ Vector3(0.0f, -1.0f, 0.0f), Vector3(0.0f, -0.5f, 0.866025f), @@ -57,19 +60,19 @@ void UVSphereTest::withoutTextureCoords() { Vector3(-0.75f, 0.5f, -0.433013f), Vector3(0.0f, 1.0f, 0.0f) - })); + }), Container); - CORRADE_COMPARE(*sphere.indices(), (vector{ + CORRADE_COMPARE_AS(*sphere.indices(), (vector{ 0, 2, 1, 0, 3, 2, 0, 1, 3, 1, 2, 5, 1, 5, 4, 2, 3, 6, 2, 6, 5, 3, 1, 4, 3, 4, 6, 4, 5, 7, 5, 6, 7, 6, 4, 7 - })); + }), Container); } void UVSphereTest::withTextureCoords() { UVSphere sphere(3, 3, UVSphere::TextureCoords::Generate); - CORRADE_COMPARE(*sphere.positions(0), (vector{ + CORRADE_COMPARE_AS(*sphere.positions(0), (vector{ Vector4(0.0f, -1.0f, 0.0f), Vector4(0.0f, -0.5f, 0.866025f), @@ -83,9 +86,9 @@ void UVSphereTest::withTextureCoords() { Vector4(0.0f, 0.5f, 0.866025f), Vector4(0.0f, 1.0f, 0.0f) - })); + }), Container); - CORRADE_COMPARE(*sphere.textureCoords2D(0), (vector{ + CORRADE_COMPARE_AS(*sphere.textureCoords2D(0), (vector{ Vector2(0.5f, 0.0f), Vector2(0.0f, 0.333333f), @@ -99,13 +102,13 @@ void UVSphereTest::withTextureCoords() { Vector2(1.0f, 0.666667f), Vector2(0.5f, 1.0f) - })); + }), Container); - CORRADE_COMPARE(*sphere.indices(), (vector{ + CORRADE_COMPARE_AS(*sphere.indices(), (vector{ 0, 2, 1, 0, 3, 2, 0, 4, 3, 1, 2, 6, 1, 6, 5, 2, 3, 7, 2, 7, 6, 3, 4, 8, 3, 8, 7, 5, 6, 9, 6, 7, 9, 7, 8, 9 - })); + }), Container); } }}}