Quellcode durchsuchen

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 vor 13 Jahren
Ursprung
Commit
94160c461c
2 geänderte Dateien mit 5 neuen und 6 gelöschten Zeilen
  1. +2
    -0
      test/unit/build.cpp
  2. +3
    -6
      test/unit/image.cpp

+ 2
- 0
test/unit/build.cpp Datei anzeigen

@@ -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 Datei anzeigen

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



Laden…
Abbrechen
Speichern