Browse Source

test: minor fixes to the test suite: disable optimisation tests in debug

mode, and do not call "new" when we’re not sure "delete" can be called.
legacy
Sam Hocevar sam 13 years ago
parent
commit
94160c461c
2 changed files with 5 additions and 6 deletions
  1. +2
    -0
      test/unit/build.cpp
  2. +3
    -6
      test/unit/image.cpp

+ 2
- 0
test/unit/build.cpp View File

@@ -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)
{


+ 3
- 6
test/unit/image.cpp View File

@@ -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;
}
};



Loading…
Cancel
Save