From f0b4338b48f721b02dbde7d0ad674e92a4de9ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Elfstr=C3=B6m?= Date: Fri, 21 Aug 2015 08:45:10 +0200 Subject: [PATCH] Add missing example tests for CHECK_ARRAY_EQUALS and CHECK_ARRAY2D_CLOSE --- tests/TestUnitTestPP.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/TestUnitTestPP.cpp b/tests/TestUnitTestPP.cpp index f260729..fe27b5f 100644 --- a/tests/TestUnitTestPP.cpp +++ b/tests/TestUnitTestPP.cpp @@ -37,6 +37,13 @@ TEST(ValidCheckCloseSucceeds) CHECK_CLOSE(2.001f, 2.0f, 0.01f); } +TEST(ArrayEqualSucceeds) +{ + int const a1[] = {1, 2, 3}; + int const a2[] = {1, 2, 3}; + CHECK_ARRAY_EQUAL(a1, a2, 3); +} + TEST(ArrayCloseSucceeds) { float const a1[] = {1, 2, 3}; @@ -44,6 +51,13 @@ TEST(ArrayCloseSucceeds) CHECK_ARRAY_CLOSE(a1, a2, 3, 0.1f); } +TEST(Array2dCloseSucceeds) +{ + float const a1[][3] = {{1, 2, 3}, {4, 5, 6}}; + float const a2[][3] = {{1, 2.01f, 3}, {4, 5.01, 6}}; + CHECK_ARRAY2D_CLOSE(a1, a2, 2, 3, 0.1f); +} + #ifndef UNITTEST_NO_EXCEPTIONS TEST(CheckThrowMacroSucceedsOnCorrectException)