From 94160c461ca6f1cf3928887edda6c3722f741ba4 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 20 Oct 2011 00:38:46 +0000 Subject: [PATCH] =?UTF-8?q?test:=20minor=20fixes=20to=20the=20test=20suite?= =?UTF-8?q?:=20disable=20optimisation=20tests=20in=20debug=20mode,=20and?= =?UTF-8?q?=20do=20not=20call=20"new"=20when=20we=E2=80=99re=20not=20sure?= =?UTF-8?q?=20"delete"=20can=20be=20called.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unit/build.cpp | 2 ++ test/unit/image.cpp | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/unit/build.cpp b/test/unit/build.cpp index 38c4372b..7199a16a 100644 --- a/test/unit/build.cpp +++ b/test/unit/build.cpp @@ -20,6 +20,7 @@ namespace lol LOLUNIT_FIXTURE(BuildTest) { +#if !defined LOL_DEBUG LOLUNIT_TEST(FastMath) { double x, y; @@ -31,6 +32,7 @@ LOLUNIT_FIXTURE(BuildTest) LOLUNIT_ASSERT_EQUAL(x, y); } +#endif LOLUNIT_TEST(FastMathOverride) { diff --git a/test/unit/image.cpp b/test/unit/image.cpp index ae2a5a80..7e291dc8 100644 --- a/test/unit/image.cpp +++ b/test/unit/image.cpp @@ -24,14 +24,13 @@ LOLUNIT_FIXTURE(ImageTest) { LOLUNIT_TEST(OpenImage) { - Image *image = new Image("data/gradient.png"); - LOLUNIT_ASSERT(image); + Image image("data/gradient.png"); - ivec2 size = image->GetSize(); + ivec2 size = image.GetSize(); LOLUNIT_ASSERT_EQUAL(size.x, 256); LOLUNIT_ASSERT_EQUAL(size.y, 16); - uint8_t *data = (uint8_t *)image->GetData(); + uint8_t *data = (uint8_t *)image.GetData(); LOLUNIT_ASSERT(data); LOLUNIT_ASSERT_EQUAL((int)data[0], 0x00); @@ -41,8 +40,6 @@ LOLUNIT_FIXTURE(ImageTest) LOLUNIT_ASSERT_EQUAL((int)data[255 * 4 + 0], 0xff); LOLUNIT_ASSERT_EQUAL((int)data[255 * 4 + 1], 0xff); LOLUNIT_ASSERT_EQUAL((int)data[255 * 4 + 2], 0xff); - - delete image; } };