From 8051719f9ff25bb9a7bd217a96acbdf0285ab78d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Sun, 10 Nov 2013 17:03:07 +0100 Subject: [PATCH] WIP on restoring unit tests on cppunit --- Makefile | 2 +- src/paysages.pro | 2 +- src/testing/main.c | 12 - src/testing/test_noise.c | 78 ------ src/testing/testing.pro | 7 - src/tests/BaseTestCase.h | 34 +++ .../Bruneton_Test.cpp} | 16 +- src/tests/Bruneton_Test.h | 18 ++ .../test_camera.c => tests/Camera_Test.cpp} | 20 +- src/tests/Camera_Test.h | 20 ++ .../test_clouds.c => tests/Clouds_Test.cpp} | 20 +- src/tests/Clouds_Test.h | 22 ++ .../test_euclid.c => tests/Euclid_Test.cpp} | 18 +- src/tests/Euclid_Test.h | 21 ++ src/tests/Layers_Test.cpp | 4 +- src/tests/NoiseGenerator_Test.cpp | 76 ++++++ src/tests/NoiseGenerator_Test.h | 18 ++ .../test_pack.c => tests/PackStream_Test.cpp} | 10 +- src/tests/PackStream_Test.h | 16 ++ .../test_render.c => tests/Render_Test.cpp} | 11 +- src/tests/Render_Test.h | 16 ++ src/tests/TerrainPainting_Test.cpp | 229 ++++++++++++++++++ src/tests/TerrainPainting_Test.h | 20 ++ src/tests/Zone_Test.cpp | 51 ++++ src/tests/Zone_Test.h | 18 ++ src/tests/main.cpp | 4 + src/tests/tests.pro | 24 +- 27 files changed, 618 insertions(+), 169 deletions(-) delete mode 100644 src/testing/test_noise.c rename src/{testing/test_bruneton.c => tests/Bruneton_Test.cpp} (93%) create mode 100644 src/tests/Bruneton_Test.h rename src/{testing/test_camera.c => tests/Camera_Test.cpp} (83%) create mode 100644 src/tests/Camera_Test.h rename src/{testing/test_clouds.c => tests/Clouds_Test.cpp} (98%) create mode 100644 src/tests/Clouds_Test.h rename src/{testing/test_euclid.c => tests/Euclid_Test.cpp} (93%) create mode 100644 src/tests/Euclid_Test.h create mode 100644 src/tests/NoiseGenerator_Test.cpp create mode 100644 src/tests/NoiseGenerator_Test.h rename src/{testing/test_pack.c => tests/PackStream_Test.cpp} (91%) create mode 100644 src/tests/PackStream_Test.h rename src/{testing/test_render.c => tests/Render_Test.cpp} (94%) create mode 100644 src/tests/Render_Test.h create mode 100644 src/tests/TerrainPainting_Test.cpp create mode 100644 src/tests/TerrainPainting_Test.h create mode 100644 src/tests/Zone_Test.cpp create mode 100644 src/tests/Zone_Test.h diff --git a/Makefile b/Makefile index a1b5e20..29951b3 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ release: +make BUILDMODE=release all tests:build - LD_LIBRARY_PATH=$(LIBRARY_PATH) CK_DEFAULT_TIMEOUT=30 ${BUILDPATH}/testing/paysages-tests + LD_LIBRARY_PATH=$(LIBRARY_PATH) ${BUILDPATH}/tests/paysages-tests run_cli:build LD_LIBRARY_PATH=$(LIBRARY_PATH) ${RUNNER} ${BUILDPATH}/controlling/paysages-cli diff --git a/src/paysages.pro b/src/paysages.pro index 706ec48..a329a7c 100644 --- a/src/paysages.pro +++ b/src/paysages.pro @@ -10,4 +10,4 @@ SUBDIRS = \ editing \ controlling -#unix:SUBDIRS += testing tests +unix:SUBDIRS += tests diff --git a/src/testing/main.c b/src/testing/main.c index 8ff131a..36c72b2 100644 --- a/src/testing/main.c +++ b/src/testing/main.c @@ -5,14 +5,8 @@ #include "System.h" int tests_cpu_count; -extern void test_euclid_case(Suite* s); -extern void test_camera_case(Suite* s); -extern void test_clouds_case(Suite* s); extern void test_render_case(Suite* s); -extern void test_noise_case(Suite* s); extern void test_terrain_painting_case(Suite* s); -extern void test_bruneton_case(Suite* s); -extern void test_pack_case(Suite* s); extern void test_zone_case(Suite* s); int main(int argc, char** argv) @@ -25,14 +19,8 @@ int main(int argc, char** argv) tests_cpu_count = systemGetCoreCount(); /* TODO Find a way to automate this */ - test_euclid_case(s); - test_camera_case(s); - test_clouds_case(s); test_render_case(s); - test_noise_case(s); test_terrain_painting_case(s); - test_bruneton_case(s); - test_pack_case(s); test_zone_case(s); SRunner *sr = srunner_create(s); diff --git a/src/testing/test_noise.c b/src/testing/test_noise.c deleted file mode 100644 index 5ab413e..0000000 --- a/src/testing/test_noise.c +++ /dev/null @@ -1,78 +0,0 @@ -#include "testing/common.h" - -#include "rendering/noise.h" - -START_TEST(test_noise_range) -{ - NoiseGenerator* noise; - double minvalue, maxvalue; - - noise = noiseCreateGenerator(); - - noiseAddLevelSimple(noise, 0.1, -1.0, 1.0); - noiseAddLevelSimple(noise, 0.2, -0.5, 0.2); - noiseAddLevelSimple(noise, 0.4, -0.3, 1.2); - noiseValidate(noise); - noiseGetRange(noise, &minvalue, &maxvalue); - - ck_assert_double_eq(minvalue, -1.8); - ck_assert_double_eq(maxvalue, 2.4); -} -END_TEST - -START_TEST(test_noise_normalize) -{ - int x; - NoiseGenerator* noise; - - noise = noiseCreateGenerator(); - - /* Symmetric case */ - noiseAddLevelsSimple(noise, 10, 1.0, -4.0, 4.0, 0.5); - noiseValidate(noise); - noiseNormalizeAmplitude(noise, -1.0, 1.0, 0); - for (x = 0; x < 1000; x++) - { - double value = noiseGet1DTotal(noise, 0.01 * (double)x); - ck_assert_double_in_range(value, -1.0, 1.0); - } - - /* Target center differs from current center */ - noiseClearLevels(noise); - noiseAddLevelsSimple(noise, 10, 1.0, -5.0, 5.0, 0.5); - noiseValidate(noise); - noiseNormalizeAmplitude(noise, 0.0, 1.0, 0); - for (x = 0; x < 1000; x++) - { - double value = noiseGet1DTotal(noise, 0.01 * (double)x); - ck_assert_double_in_range(value, 0.0, 1.0); - } - - /* Asymmetric range */ - noiseClearLevels(noise); - noiseAddLevelsSimple(noise, 10, 1.0, 0.0, 10.0, 0.0); - noiseValidate(noise); - noiseNormalizeAmplitude(noise, 0.0, 1.0, 0); - for (x = 0; x < 1000; x++) - { - double value = noiseGet1DTotal(noise, 0.01 * (double)x); - ck_assert_double_in_range(value, 0.0, 1.0); - } - - /* Complex asymmetric case */ - noiseClearLevels(noise); - noiseAddLevelsSimple(noise, 3, 1.0, -2.0, 8.0, 0.3); - noiseValidate(noise); - noiseNormalizeAmplitude(noise, -2.0, 4.0, 0.0); - for (x = 0; x < 1000; x++) - { - double value = noiseGet1DTotal(noise, 0.01 * (double)x); - ck_assert_double_in_range(value, -2.0, 4.0); - } - - noiseDeleteGenerator(noise); -} -END_TEST - -TEST_CASE(noise, test_noise_range, test_noise_normalize) - diff --git a/src/testing/testing.pro b/src/testing/testing.pro index 05fc92e..305b965 100644 --- a/src/testing/testing.pro +++ b/src/testing/testing.pro @@ -15,13 +15,6 @@ INCLUDEPATH += $$PWD/.. SOURCES += main.c \ test_terrain_painting.c \ - test_render.c \ - test_pack.c \ - test_noise.c \ - test_euclid.c \ - test_clouds.c \ - test_camera.c \ - test_bruneton.c \ test_zone.c HEADERS += \ diff --git a/src/tests/BaseTestCase.h b/src/tests/BaseTestCase.h index 2667c29..70361f7 100644 --- a/src/tests/BaseTestCase.h +++ b/src/tests/BaseTestCase.h @@ -7,6 +7,40 @@ #include using namespace CppUnit; +// Transitional macros from C libcheck +static inline int _double_equals(double x, double y) +{ + return fabs(x - y) < 0.00000000001; +} +static inline int _double_not_equals(double x, double y) +{ + return fabs(x - y) >= 0.00000000001; +} +static inline int _double_greater(double x, double y) +{ + return _double_not_equals(x, y) && (x > y); +} +static inline int _double_greater_or_equal(double x, double y) +{ + return _double_equals(x, y) || (x >= y); +} +static inline int _double_less(double x, double y) +{ + return _double_not_equals(x, y) && (x < y); +} +static inline int _double_less_or_equal(double x, double y) +{ + return _double_equals(x, y) || (x <= y); +} + +#define _ck_assert_double(F, X, O, Y) CPPUNIT_ASSERT(F(X, Y), "Assertion '"#X#O#Y"' failed: "#X"=%.12f, "#Y"=%.12f", X, Y) +#define ck_assert_double_eq(X, Y) _ck_assert_double(_double_equals, X, ==, Y) +#define ck_assert_double_ne(X, Y) _ck_assert_double(_double_not_equals, X, !=, Y) +#define ck_assert_double_gt(X, Y) _ck_assert_double(_double_greater, X, >, Y) +#define ck_assert_double_lt(X, Y) _ck_assert_double(_double_less, X, <, Y) +#define ck_assert_double_gte(X, Y) _ck_assert_double(_double_greater_or_equal, X, >=, Y) +#define ck_assert_double_lte(X, Y) _ck_assert_double(_double_less_or_equal, X, <=, Y) + class BaseTestCase: public TestFixture { public: diff --git a/src/testing/test_bruneton.c b/src/tests/Bruneton_Test.cpp similarity index 93% rename from src/testing/test_bruneton.c rename to src/tests/Bruneton_Test.cpp index 6055520..0950a5e 100644 --- a/src/testing/test_bruneton.c +++ b/src/tests/Bruneton_Test.cpp @@ -1,6 +1,7 @@ -#include "testing/common.h" +#include "Bruneton_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(Bruneton_Test); + #include "System.h" -#include "rendering/Scenery.h" #define OUTPUT_WIDTH 400 #define OUTPUT_HEIGHT 300 @@ -10,7 +11,7 @@ static Color _postProcessFragment(Renderer* renderer, Vector3 location, void* da return renderer->atmosphere->applyAerialPerspective(renderer, location, COLOR_BLACK).final; } -START_TEST(testBrunetonAerialPerspective) +Bruneton_Test::testBrunetonAerialPerspective() { Renderer* renderer = sceneryCreateStandardRenderer(); renderer->render_width = 800; @@ -37,9 +38,8 @@ START_TEST(testBrunetonAerialPerspective) rendererDelete(renderer); } -END_TEST -START_TEST(testBrunetonAerialPerspective1) +Bruneton_Test::testBrunetonAerialPerspective1() { AtmosphereDefinition* atmo = AtmosphereDefinitionClass.create(); sceneryGetAtmosphere(atmo); @@ -73,9 +73,3 @@ START_TEST(testBrunetonAerialPerspective1) rendererDelete(renderer); } -END_TEST - -TEST_CASE(bruneton, - testBrunetonAerialPerspective, - testBrunetonAerialPerspective1) - diff --git a/src/tests/Bruneton_Test.h b/src/tests/Bruneton_Test.h new file mode 100644 index 0000000..525b8bd --- /dev/null +++ b/src/tests/Bruneton_Test.h @@ -0,0 +1,18 @@ +#ifndef BRUNETON_TEST_H +#define BRUNETON_TEST_H + +#include "BaseTestCase.h" + +class Bruneton_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(Bruneton_Test); + CPPUNIT_TEST(testBrunetonAerialPerspective); + CPPUNIT_TEST(testBrunetonAerialPerspective1); + CPPUNIT_TEST_SUITE_END(); + + void testBrunetonAerialPerspective(); + void testBrunetonAerialPerspective1(); +}; + +#endif // BRUNETON_TEST_H diff --git a/src/testing/test_camera.c b/src/tests/Camera_Test.cpp similarity index 83% rename from src/testing/test_camera.c rename to src/tests/Camera_Test.cpp index 3cff93f..4152d42 100644 --- a/src/testing/test_camera.c +++ b/src/tests/Camera_Test.cpp @@ -1,8 +1,9 @@ -#include "testing/common.h" +#include "Camera_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(Camera_Test); -#include "rendering/camera.h" +#include "camera.h" -START_TEST(test_camera_definition) +void Camera_Test::test_camera_definition() { CameraDefinition* cam; cam = cameraCreateDefinition(); @@ -15,9 +16,8 @@ START_TEST(test_camera_definition) cameraDeleteDefinition(cam); } -END_TEST -START_TEST(test_camera_projection) +void Camera_Test::test_camera_projection() { CameraDefinition* cam; cam = cameraCreateDefinition(); @@ -35,9 +35,8 @@ START_TEST(test_camera_projection) cameraDeleteDefinition(cam); } -END_TEST -START_TEST(test_camera_depth) +void Camera_Test::test_camera_depth() { CameraDefinition* cam; cam = cameraCreateDefinition(); @@ -55,10 +54,3 @@ START_TEST(test_camera_depth) cameraDeleteDefinition(cam); } -END_TEST - -TEST_CASE(camera, - test_camera_definition, - test_camera_projection, - test_camera_depth) - diff --git a/src/tests/Camera_Test.h b/src/tests/Camera_Test.h new file mode 100644 index 0000000..415be97 --- /dev/null +++ b/src/tests/Camera_Test.h @@ -0,0 +1,20 @@ +#ifndef CAMERA_TEST_H +#define CAMERA_TEST_H + +#include "BaseTestCase.h" + +class Camera_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(Camera_Test); + CPPUNIT_TEST(test_camera_definition); + CPPUNIT_TEST(test_camera_projection); + CPPUNIT_TEST(test_camera_depth); + CPPUNIT_TEST_SUITE_END(); + + void test_camera_definition(); + void test_camera_projection(); + void test_camera_depth(); +}; + +#endif // CAMERA_TEST_H diff --git a/src/testing/test_clouds.c b/src/tests/Clouds_Test.cpp similarity index 98% rename from src/testing/test_clouds.c rename to src/tests/Clouds_Test.cpp index d76fe93..b4aa10d 100644 --- a/src/testing/test_clouds.c +++ b/src/tests/Clouds_Test.cpp @@ -1,4 +1,5 @@ -#include "testing/common.h" +#include "Clouds_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(Clouds_Test); #include "rendering/renderer.h" #include "rendering/tools.h" @@ -6,7 +7,7 @@ #include "rendering/clouds/clo_density.h" #include "rendering/clouds/clo_walking.h" -START_TEST(test_clouds_density) +Clouds_Test::test_clouds_density() { /* Setup */ double x, y, z; @@ -85,7 +86,7 @@ START_TEST(test_clouds_density) } END_TEST -START_TEST(test_clouds_walking_boundaries) +Clouds_Test::test_clouds_walking_boundaries() { Vector3 start, end; int result; @@ -190,7 +191,6 @@ START_TEST(test_clouds_walking_boundaries) cloudsGetLayerType().callback_delete(layer); } -END_TEST static double _getLayerDensitySinX(Renderer* renderer, CloudsLayerDefinition* layer, Vector3 location) { @@ -209,7 +209,7 @@ static double _getEdgeDensitySquared(Renderer* renderer, CloudsLayerDefinition* } -START_TEST(test_clouds_walking) +Clouds_Test::test_clouds_walking() { /* Init */ CloudsLayerDefinition* layer; @@ -421,9 +421,8 @@ START_TEST(test_clouds_walking) cloudsGetLayerType().callback_delete(layer); rendererDelete(renderer); } -END_TEST -START_TEST(test_clouds_walking_local) +Clouds_Test::test_clouds_walking_local() { /* Init */ CloudsLayerDefinition* layer; @@ -465,10 +464,3 @@ START_TEST(test_clouds_walking_local) ck_assert_double_eq(segment->end.global_density, 0.809016994375); ck_assert_double_eq(segment->end.local_density, 0.654508497187); } -END_TEST - -TEST_CASE(clouds, - test_clouds_density, - test_clouds_walking, - test_clouds_walking_boundaries, - test_clouds_walking_local) diff --git a/src/tests/Clouds_Test.h b/src/tests/Clouds_Test.h new file mode 100644 index 0000000..a1f9aec --- /dev/null +++ b/src/tests/Clouds_Test.h @@ -0,0 +1,22 @@ +#ifndef CLOUDS_TEST_H +#define CLOUDS_TEST_H + +#include "BaseTestCase.h" + +class Clouds_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(Clouds_Test); + CPPUNIT_TEST(test_clouds_density); + CPPUNIT_TEST(test_clouds_walking_boundaries); + CPPUNIT_TEST(test_clouds_walking); + CPPUNIT_TEST(test_clouds_walking_local); + CPPUNIT_TEST_SUITE_END(); + + void test_clouds_density(); + void test_clouds_walking_boundaries(); + void test_clouds_walking(); + void test_clouds_walking_local(); +}; + +#endif // CLOUDS_TEST_H diff --git a/src/testing/test_euclid.c b/src/tests/Euclid_Test.cpp similarity index 93% rename from src/testing/test_euclid.c rename to src/tests/Euclid_Test.cpp index 073e3e5..a95c168 100644 --- a/src/testing/test_euclid.c +++ b/src/tests/Euclid_Test.cpp @@ -1,4 +1,6 @@ -#include "testing/common.h" +#include "Euclid_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(Euclid_Test); + #include "rendering/tools/euclid.h" static inline int _Vector3_cmp(Vector3 v1, Vector3 v2) @@ -12,7 +14,7 @@ static inline void _Vector3_str(Vector3 v, char* buffer, int length) } DEFINE_COMPARE_ASSERT(Vector3, _Vector3_cmp, _Vector3_str); -START_TEST(test_euclid_angles) +Euclid_Test::test_euclid_angles() { ck_assert_double_eq(euclidGet2DAngle(0.0, 0.0), 0.0); @@ -38,9 +40,7 @@ START_TEST(test_euclid_angles) ck_assert_double_eq(euclidGet2DAngle(-0.5, -0.5), 5.0 * M_PI_4); } -END_TEST - -START_TEST(test_vectors) +Euclid_Test::test_vectors() { Vector3 v1, v2, v3; @@ -58,9 +58,7 @@ START_TEST(test_vectors) ck_assert_generic_eq(Vector3, v3Scale(v1, -0.5), v3); } -END_TEST - -START_TEST(test_vectors_spherical) +Euclid_Test::test_vectors_spherical() { Vector3 v1; VectorSpherical v2; @@ -128,7 +126,3 @@ START_TEST(test_vectors_spherical) ck_assert_double_eq(v2.phi, 7.0 * M_PI_4); ck_assert_double_eq(v2.theta, M_PI_2 - 0.955316618125); } -END_TEST - -TEST_CASE(euclid, test_euclid_angles, test_vectors, test_vectors_spherical) - diff --git a/src/tests/Euclid_Test.h b/src/tests/Euclid_Test.h new file mode 100644 index 0000000..4cd0d50 --- /dev/null +++ b/src/tests/Euclid_Test.h @@ -0,0 +1,21 @@ +#ifndef EUCLID_TEST_H +#define EUCLID_TEST_H + +#include "BaseTestCase.h" + +class Euclid_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(Euclid_Test); + CPPUNIT_TEST(test_camera_definition); + CPPUNIT_TEST(test_camera_projection); + CPPUNIT_TEST(test_camera_depth); + CPPUNIT_TEST_SUITE_END(); + + void test_camera_definition(); + void test_camera_projection(); + void test_camera_depth(); + +}; + +#endif // EUCLID_TEST_H diff --git a/src/tests/Layers_Test.cpp b/src/tests/Layers_Test.cpp index c89b03f..89e1c8a 100644 --- a/src/tests/Layers_Test.cpp +++ b/src/tests/Layers_Test.cpp @@ -1,6 +1,8 @@ #include "Layers_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(Layers_Test); #include "Layers.h" +#include "PackStream.h" BaseDefinition* _construc1(Layers*) { @@ -166,5 +168,3 @@ void Layers_Test::testLegacyLayers() delete layers1; CPPUNIT_ASSERT_EQUAL(0, _legacy_instance_count); } - -CPPUNIT_TEST_SUITE_REGISTRATION(Layers_Test); diff --git a/src/tests/NoiseGenerator_Test.cpp b/src/tests/NoiseGenerator_Test.cpp new file mode 100644 index 0000000..aa69d66 --- /dev/null +++ b/src/tests/NoiseGenerator_Test.cpp @@ -0,0 +1,76 @@ +#include "NoiseGenerator_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(NoiseGenerator_Test); + +#include "NoiseGenerator.h" + +void NoiseGenerator_Test::test_noise_range() +{ + NoiseGenerator* noise; + double minvalue, maxvalue; + + noise = new NoiseGenerator(); + + noise->addLevelSimple(0.1, -1.0, 1.0); + noise->addLevelSimple(0.2, -0.5, 0.2); + noise->addLevelSimple(0.4, -0.3, 1.2); + noise->validate(); + noise->getRange(&minvalue, &maxvalue); + + ck_assert_double_eq(minvalue, -1.8); + ck_assert_double_eq(maxvalue, 2.4); + + delete noise; +} + +void NoiseGenerator_Test::test_noise_normalize() +{ + int x; + NoiseGenerator* noise; + + noise = new NoiseGenerator(); + + /* Symmetric case */ + noise->addLevelsSimple( 10, 1.0, -4.0, 4.0, 0.5); + noise->validate(); + noise->normalizeAmplitude( -1.0, 1.0, 0); + for (x = 0; x < 1000; x++) + { + double value = noise->get1DTotal( 0.01 * (double)x); + ck_assert_double_in_range(value, -1.0, 1.0); + } + + /* Target center differs from current center */ + noise->clearLevels(); + noise->addLevelsSimple( 10, 1.0, -5.0, 5.0, 0.5); + noise->validate(); + noise->normalizeAmplitude( 0.0, 1.0, 0); + for (x = 0; x < 1000; x++) + { + double value = noise->get1DTotal(0.01 * (double)x); + ck_assert_double_in_range(value, 0.0, 1.0); + } + + /* Asymmetric range */ + noise->clearLevels(); + noise->addLevelsSimple(10, 1.0, 0.0, 10.0, 0.0); + noise->validate(); + noise->normalizeAmplitude(0.0, 1.0, 0); + for (x = 0; x < 1000; x++) + { + double value = noise->get1DTotal(0.01 * (double)x); + ck_assert_double_in_range(value, 0.0, 1.0); + } + + /* Complex asymmetric case */ + noise->clearLevels(); + noise->addLevelsSimple(3, 1.0, -2.0, 8.0, 0.3); + noise->validate(); + noise->normalizeAmplitude(-2.0, 4.0, 0.0); + for (x = 0; x < 1000; x++) + { + double value = noise->get1DTotal(0.01 * (double)x); + ck_assert_double_in_range(value, -2.0, 4.0); + } + + delete noise; +} diff --git a/src/tests/NoiseGenerator_Test.h b/src/tests/NoiseGenerator_Test.h new file mode 100644 index 0000000..58e3733 --- /dev/null +++ b/src/tests/NoiseGenerator_Test.h @@ -0,0 +1,18 @@ +#ifndef NOISEGENERATOR_TEST_H +#define NOISEGENERATOR_TEST_H + +#include "BaseTestCase.h" + +class NoiseGenerator_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(NoiseGenerator_Test); + CPPUNIT_TEST(test_noise_range); + CPPUNIT_TEST(test_noise_normalize); + CPPUNIT_TEST_SUITE_END(); + + void test_noise_range(); + void test_noise_normalize(); +}; + +#endif // NOISEGENERATOR_TEST_H diff --git a/src/testing/test_pack.c b/src/tests/PackStream_Test.cpp similarity index 91% rename from src/testing/test_pack.c rename to src/tests/PackStream_Test.cpp index 7799bb4..ad7bc6e 100644 --- a/src/testing/test_pack.c +++ b/src/tests/PackStream_Test.cpp @@ -1,8 +1,9 @@ -#include "testing/common.h" +#include "PackStream_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(PackStream_Test); #include "PackStream.h" -START_TEST(testPack) +void PackStream_Test::testPack() { PackStream* stream; int i; @@ -47,8 +48,3 @@ START_TEST(testPack) } packCloseStream(stream); } -END_TEST - -TEST_CASE(pack, - testPack) - diff --git a/src/tests/PackStream_Test.h b/src/tests/PackStream_Test.h new file mode 100644 index 0000000..eb864c3 --- /dev/null +++ b/src/tests/PackStream_Test.h @@ -0,0 +1,16 @@ +#ifndef PACKSTREAM_TEST_H +#define PACKSTREAM_TEST_H + +#include "BaseTestCase.h" + +class PackStream_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(PackStream_Test); + CPPUNIT_TEST(testPack); + CPPUNIT_TEST_SUITE_END(); + + void testPack(); +}; + +#endif // PACKSTREAM_TEST_H diff --git a/src/testing/test_render.c b/src/tests/Render_Test.cpp similarity index 94% rename from src/testing/test_render.c rename to src/tests/Render_Test.cpp index 4031933..1bf86d1 100644 --- a/src/testing/test_render.c +++ b/src/tests/Render_Test.cpp @@ -1,6 +1,7 @@ -#include "testing/common.h" +#include "Render_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(Render_Test); -#include +#include #include "rendering/renderer.h" #include "rendering/tools.h" @@ -30,7 +31,7 @@ static Color _postProcessFragment(Renderer* renderer, Vector3 location, void* da } } -START_TEST(test_render_quad) +Render_Test::test_render_quad() { Color col; Renderer* renderer = rendererCreate(); @@ -66,7 +67,3 @@ START_TEST(test_render_quad) rendererDelete(renderer); } -END_TEST - -TEST_CASE(render, test_render_quad) - diff --git a/src/tests/Render_Test.h b/src/tests/Render_Test.h new file mode 100644 index 0000000..2786cf9 --- /dev/null +++ b/src/tests/Render_Test.h @@ -0,0 +1,16 @@ +#ifndef RENDER_TEST_H +#define RENDER_TEST_H + +#include "BaseTestCase.h" + +class Render_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(Render_Test); + CPPUNIT_TEST(test_render_quad); + CPPUNIT_TEST_SUITE_END(); + + void test_render_quad(); +}; + +#endif // RENDER_TEST_H diff --git a/src/tests/TerrainPainting_Test.cpp b/src/tests/TerrainPainting_Test.cpp new file mode 100644 index 0000000..c26813f --- /dev/null +++ b/src/tests/TerrainPainting_Test.cpp @@ -0,0 +1,229 @@ +#include "TerrainPainting_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(TerrainPainting_Test); + +#include +#include "rendering/tools.h" +#include "rendering/terrain/public.h" + +/* Noise sin period is defined at 20.0 */ +#define X_FACTOR (M_PI / 10.0) + +static double _noise1dMock(double x) +{ + return sin(x * X_FACTOR) * 0.5 + 0.5; +} + +static double _noise2dMock(double x, double y) +{ + UNUSED(y); + return sin(x * X_FACTOR) * 0.5 + 0.5; +} + +static double _noise3dMock(double x, double y, double z) +{ + UNUSED(y); + UNUSED(z); + return sin(x * X_FACTOR) * 0.5 + 0.5; +} + +static TerrainDefinition* _setUpDefinition() +{ + TerrainDefinition* terrain = (TerrainDefinition*)TerrainDefinitionClass.create(); + terrain->height = 3.0; + terrain->scaling = 1.0; + noiseClearLevels(terrain->_height_noise); + NoiseLevel level = {1.0, 2.0, -1.0, 0.0, 0.0, 0.0}; + noiseAddLevel(terrain->_height_noise, level, 0); + noiseSetCustomFunction(terrain->_height_noise, _noise1dMock, _noise2dMock, _noise3dMock); + return terrain; +} + +static void _tearDownDefinition(TerrainDefinition* terrain) +{ + TerrainDefinitionClass.destroy(terrain); +} + +TerrainPainting_Test::test_terrain_painting_grid() +{ + /* Set up */ + TerrainDefinition* terrain = _setUpDefinition(); + + /* Test base grid */ + ck_assert_double_eq(terrainGetGridHeight(terrain, 0, 0, 0), 0.0); + ck_assert_double_eq(terrainGetGridHeight(terrain, 0, 1, 0), 0.0); + ck_assert_double_eq(terrainGetGridHeight(terrain, 0, 0, 1), 0.0); + ck_assert_double_eq(terrainGetGridHeight(terrain, 1, 0, 0), sin(1.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetGridHeight(terrain, 2, 0, 0), sin(2.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetGridHeight(terrain, 3, 0, 0), sin(3.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetGridHeight(terrain, 4, 0, 0), sin(4.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetGridHeight(terrain, 5, 0, 0), 1.0); + ck_assert_double_eq(terrainGetGridHeight(terrain, 6, 0, 0), sin(4.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetGridHeight(terrain, -1, 0, 0), -sin(1.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetGridHeight(terrain, 10, 0, 0), 0.0); + ck_assert_double_eq(terrainGetGridHeight(terrain, 15, 0, 0), -1.0); + ck_assert_double_eq(terrainGetGridHeight(terrain, 20, 0, 0), 0.0); + ck_assert_double_eq(terrainGetGridHeight(terrain, -5, 0, 0), -1.0); + + /* Test interpolated result */ + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 0.0, 0.0, 0, 0), 0.0); + ck_assert_double_in_range(terrainGetInterpolatedHeight(terrain, 0.5, 0.0, 0, 0), 0.1564, 0.1566); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 1.0, 0.0, 0, 0), sin(1.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 0.0, 0.0, 1, 0), 0.0); + ck_assert_double_in_range(terrainGetInterpolatedHeight(terrain, 0.5, 0.0, 1, 0), 3.0 * 0.1564, 3.0 * 0.1566); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 1.0, 0.0, 1, 0), 3.0 * sin(1.0 * X_FACTOR)); + + /* Test scaling */ + terrain->scaling = 2.0; + ck_assert_double_eq(terrainGetGridHeight(terrain, 0, 0, 0), 0.0); + ck_assert_double_eq(terrainGetGridHeight(terrain, 1, 0, 0), sin(1.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetGridHeight(terrain, 2, 0, 0), sin(2.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetGridHeight(terrain, 3, 0, 0), sin(3.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 0, 0, 0, 0), 0.0); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 1, 0, 0, 0), sin(0.5 * X_FACTOR)); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 2, 0, 0, 0), sin(1.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 3, 0, 0, 0), sin(1.5 * X_FACTOR)); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 0, 0, 1, 0), 0.0); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 1, 0, 1, 0), 6.0 * sin(0.5 * X_FACTOR)); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 2, 0, 1, 0), 6.0 * sin(1.0 * X_FACTOR)); + ck_assert_double_eq(terrainGetInterpolatedHeight(terrain, 3, 0, 1, 0), 6.0 * sin(1.5 * X_FACTOR)); + + /* Tear down */ + _tearDownDefinition(terrain); +} + +static void _checkBrushResultSides(TerrainDefinition* terrain, TerrainBrush* brush, double center, double midhard, double hard, double midsoft, double soft, double exter, double neg_midhard, double neg_hard, double neg_midsoft, double neg_soft, double neg_exter) +{ + UNUSED(brush); + + ck_assert_double_eq(terrainGetGridHeight(terrain, 0, 0, 1), center); + + ck_assert_double_eq(terrainGetGridHeight(terrain, 1, 0, 1), midhard); + ck_assert_double_eq(terrainGetGridHeight(terrain, 2, 0, 1), hard); + ck_assert_double_eq(terrainGetGridHeight(terrain, 3, 0, 1), midsoft); + ck_assert_double_eq(terrainGetGridHeight(terrain, 4, 0, 1), soft); + ck_assert_double_eq(terrainGetGridHeight(terrain, 5, 0, 1), exter); + + ck_assert_double_eq(terrainGetGridHeight(terrain, -1, 0, 1), neg_midhard); + ck_assert_double_eq(terrainGetGridHeight(terrain, -2, 0, 1), neg_hard); + ck_assert_double_eq(terrainGetGridHeight(terrain, -3, 0, 1), neg_midsoft); + ck_assert_double_eq(terrainGetGridHeight(terrain, -4, 0, 1), neg_soft); + ck_assert_double_eq(terrainGetGridHeight(terrain, -5, 0, 1), neg_exter); +} + +static void _checkBrushResult(TerrainDefinition* terrain, TerrainBrush* brush, double center, double midhard, double hard, double midsoft, double soft, double exter, int mirror) +{ + if (mirror) + { + _checkBrushResultSides(terrain, brush, center, midhard, hard, midsoft, soft, exter, -midhard, -hard, -midsoft, -soft, -exter); + } + else + { + _checkBrushResultSides(terrain, brush, center, midhard, hard, midsoft, soft, exter, midhard, hard, midsoft, soft, exter); + } +} + +TerrainPainting_Test::test_terrain_painting_brush_flatten() +{ + /* Set up */ + TerrainDefinition* terrain = _setUpDefinition(); + TerrainBrush brush = {0.0, 0.0, 2.0, 2.0, 4.0}; + terrain->height = 1.0; + terrain->scaling = 1.0; + noiseForceValue(terrain->_height_noise, 0.0); + + /* Test flattening center at 0.5 */ + _checkBrushResult(terrain, &brush, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); + terrainBrushFlatten(terrain->height_map, &brush, 0.5, 1.0); + _checkBrushResult(terrain, &brush, 0.5, 0.5, 0.5, 0.25, 0.0, 0.0, 0); + + /* Test brush strength */ + terrainClearPainting(terrain->height_map); + _checkBrushResult(terrain, &brush, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); + terrainBrushFlatten(terrain->height_map, &brush, 0.5, 0.01); + _checkBrushResult(terrain, &brush, 0.005, 0.005, 0.005, 0.0025, 0.0, 0.0, 0); + + /* Test cumulative effect */ + terrainBrushFlatten(terrain->height_map, &brush, 0.5, 0.01); + _checkBrushResult(terrain, &brush, 0.00995, 0.00995, 0.00995, 0.0049875, 0.0, 0.0, 0); + + /* Test with height modifier */ + terrain->height = 10.0; + terrainClearPainting(terrain->height_map); + _checkBrushResult(terrain, &brush, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); + terrainBrushFlatten(terrain->height_map, &brush, 0.5, 1.0); + _checkBrushResult(terrain, &brush, 0.05, 0.05, 0.05, 0.025, 0.0, 0.0, 0); + + /* Test with scaling modifier */ + terrain->height = 10.0; + terrain->scaling = 2.0; + terrainClearPainting(terrain->height_map); + _checkBrushResult(terrain, &brush, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); + terrainBrushFlatten(terrain->height_map, &brush, 0.5, 1.0); + _checkBrushResult(terrain, &brush, 0.05, 0.05, 0.05, 0.025, 0.0, 0.0, 0); + + /* Tear down */ + _tearDownDefinition(terrain); +} + +TerrainPainting_Test::test_terrain_painting_brush_reset() +{ + /* Set up */ + TerrainDefinition* terrain = _setUpDefinition(); + TerrainBrush brush = {0.0, 0.0, 2.0, 2.0, 4.0}; + TerrainBrush brush_full = {0.0, 0.0, 4.0, 0.0, 4.0}; + terrain->height = 1.0; + terrain->scaling = 1.0; + noiseForceValue(terrain->_height_noise, 1.0); + + /* Test resetting at center */ + _checkBrushResult(terrain, &brush, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0); + terrainBrushFlatten(terrain->height_map, &brush_full, 2.0, 1.0); + _checkBrushResult(terrain, &brush, 2.0, 2.0, 2.0, 2.0, 2.0, 1.0, 0); + terrainBrushReset(terrain->height_map, &brush, 1.0); + _checkBrushResult(terrain, &brush, 1.0, 1.0, 1.0, 1.5, 2.0, 1.0, 0); + + /* Test brush strength */ + terrainClearPainting(terrain->height_map); + _checkBrushResult(terrain, &brush, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0); + terrainBrushFlatten(terrain->height_map, &brush_full, 2.0, 1.0); + _checkBrushResult(terrain, &brush, 2.0, 2.0, 2.0, 2.0, 2.0, 1.0, 0); + terrainBrushReset(terrain->height_map, &brush, 0.1); + _checkBrushResult(terrain, &brush, 1.9, 1.9, 1.9, 1.95, 2.0, 1.0, 0); + + /* Test cumulative effect */ + terrainBrushReset(terrain->height_map, &brush, 0.1); + _checkBrushResult(terrain, &brush, 1.81, 1.81, 1.81, 1.9025, 2.0, 1.0, 0); + + /* Test with height modifier */ + terrain->height = 10.0; + terrainClearPainting(terrain->height_map); + _checkBrushResult(terrain, &brush, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0); + terrainBrushFlatten(terrain->height_map, &brush_full, 2.0, 1.0); + _checkBrushResult(terrain, &brush, 1.1, 1.1, 1.1, 1.1, 1.1, 1.0, 0); + terrainBrushReset(terrain->height_map, &brush, 0.1); + _checkBrushResult(terrain, &brush, 1.099, 1.099, 1.099, 1.0995, 1.1, 1.0, 0); + + /* Test with scaling modifier */ + terrain->height = 10.0; + terrain->scaling = 2.0; + terrainClearPainting(terrain->height_map); + _checkBrushResult(terrain, &brush, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0); + terrainBrushFlatten(terrain->height_map, &brush_full, 2.0, 1.0); + _checkBrushResult(terrain, &brush, 1.1, 1.1, 1.1, 1.1, 1.1, 1.0, 0); + terrainBrushReset(terrain->height_map, &brush, 0.1); + _checkBrushResult(terrain, &brush, 1.099, 1.099, 1.099, 1.0995, 1.1, 1.0, 0); + + /* Tear down */ + _tearDownDefinition(terrain); + + /* Test with scaling and the sinusoid setup (to test the basevalue sampling) */ + terrain = _setUpDefinition(); + terrain->height = 1.0; + terrain->scaling = 2.0; + _checkBrushResult(terrain, &brush, 0.0, 0.309016994375, 0.587785252292, 0.809016994375, 0.951056516295, 1.0, 1); + terrainBrushFlatten(terrain->height_map, &brush_full, 2.0, 1.0); + _checkBrushResultSides(terrain, &brush, 2.0, 2.0, 2.0, 2.0, 2.0, 1.0, 2.0, 2.0, 2.0, 2.0, -1.0); + terrainBrushReset(terrain->height_map, &brush, 1.0); + _checkBrushResultSides(terrain, &brush, 0.0, 0.309016994375, 0.587785252292, 2.0 - (2.0 - 0.809016994375) * 0.5, 2.0, 1.0, -0.309016994375, -0.587785252292, 2.0 - (2.0 + 0.809016994375) * 0.5, 2.0, -1.0); + _tearDownDefinition(terrain); +} diff --git a/src/tests/TerrainPainting_Test.h b/src/tests/TerrainPainting_Test.h new file mode 100644 index 0000000..b149ee1 --- /dev/null +++ b/src/tests/TerrainPainting_Test.h @@ -0,0 +1,20 @@ +#ifndef TERRAINPAINTING_TEST_H +#define TERRAINPAINTING_TEST_H + +#include "BaseTestCase.h" + +class TerrainPainting_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(TerrainPainting_Test); + CPPUNIT_TEST(test_terrain_painting_grid); + CPPUNIT_TEST(test_terrain_painting_brush_flatten); + CPPUNIT_TEST(test_terrain_painting_brush_reset); + CPPUNIT_TEST_SUITE_END(); + + void test_terrain_painting_grid(); + void test_terrain_painting_brush_flatten(); + void test_terrain_painting_brush_reset(); +}; + +#endif // TERRAINPAINTING_TEST_H diff --git a/src/tests/Zone_Test.cpp b/src/tests/Zone_Test.cpp new file mode 100644 index 0000000..e373b86 --- /dev/null +++ b/src/tests/Zone_Test.cpp @@ -0,0 +1,51 @@ +#include "Zone_Test.h" +CPPUNIT_TEST_SUITE_REGISTRATION(Zone_Test); + +#include "rendering/tools/zone.h" + +Zone_Test::testZoneAbsoluteHeight() +{ + Zone* zone = zoneCreate(); + + zoneAddHeightRangeQuick(zone, 1.0, -1.0, 2.0, 5.0, 6.0); + + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -10.0, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -2.0, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -1.0, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -0.5, 0.0), VECTOR_UP), 1.0 / 6.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 0.0, 0.0), VECTOR_UP), 1.0 / 3.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 0.5, 0.0), VECTOR_UP), 0.5); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 2.0, 0.0), VECTOR_UP), 1.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 2.1, 0.0), VECTOR_UP), 1.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 3.5, 0.0), VECTOR_UP), 1.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 4.9, 0.0), VECTOR_UP), 1.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 5.0, 0.0), VECTOR_UP), 1.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 5.2, 0.0), VECTOR_UP), 0.8); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 5.7, 0.0), VECTOR_UP), 0.3); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 6.0, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 15.0, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 150.0, 0.0), VECTOR_UP), 0.0); + + zoneDelete(zone); +} + +Zone_Test::testZoneRelativeHeight() +{ + Zone* zone = zoneCreate(); + + zoneAddHeightRangeQuick(zone, 1.0, 0.2, 0.3, 0.6, 0.9); + zoneSetRelativeHeight(zone, -2.0, 2.0, 8.0); + + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -10.0, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -2.1, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -2.0, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -1.0, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -0.5, 0.0), VECTOR_UP), 0.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, -0.2, 0.0), VECTOR_UP), 0.25); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 0.0, 0.0), VECTOR_UP), 0.5); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 0.3, 0.0), VECTOR_UP), 0.875); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 0.5, 0.0), VECTOR_UP), 1.0); + ck_assert_double_eq(zoneGetValue(zone, v3(0.0, 1.0, 0.0), VECTOR_UP), 1.0); + + zoneDelete(zone); +} diff --git a/src/tests/Zone_Test.h b/src/tests/Zone_Test.h new file mode 100644 index 0000000..add0539 --- /dev/null +++ b/src/tests/Zone_Test.h @@ -0,0 +1,18 @@ +#ifndef ZONE_TEST_H +#define ZONE_TEST_H + +#include "BaseTestCase.h" + +class Zone_Test: public BaseTestCase +{ +public: + CPPUNIT_TEST_SUITE(Zone_Test); + CPPUNIT_TEST(testZoneAbsoluteHeight); + CPPUNIT_TEST(testZoneRelativeHeight); + CPPUNIT_TEST_SUITE_END(); + + void testZoneAbsoluteHeight(); + void testZoneRelativeHeight(); +}; + +#endif // ZONE_TEST_H diff --git a/src/tests/main.cpp b/src/tests/main.cpp index fa3a65b..fed4ae3 100644 --- a/src/tests/main.cpp +++ b/src/tests/main.cpp @@ -10,6 +10,8 @@ void noMessageOutput(QtMsgType, const QMessageLogContext&, const QString&) int main() { + paysagesInit(); + qInstallMessageHandler(noMessageOutput); TextTestRunner runner; @@ -17,6 +19,8 @@ int main() runner.addTest(registry.makeTest()); + paysagesQuit(); + return runner.run() ? 1 : 0; } diff --git a/src/tests/tests.pro b/src/tests/tests.pro index 1205e5c..9964aff 100644 --- a/src/tests/tests.pro +++ b/src/tests/tests.pro @@ -2,7 +2,7 @@ TEMPLATE = app CONFIG += console CONFIG -= app_bundle -TARGET = paysages-tests2 +TARGET = paysages-tests unix { CONFIG += link_pkgconfig @@ -11,11 +11,29 @@ unix { SOURCES += main.cpp \ Layers_Test.cpp \ - BaseTestCase.cpp + BaseTestCase.cpp \ + Camera_Test.cpp \ + NoiseGenerator_Test.cpp \ + PackStream_Test.cpp \ + Bruneton_Test.cpp \ + Clouds_Test.cpp \ + Euclid_Test.cpp \ + Render_Test.cpp \ + TerrainPainting_Test.cpp \ + Zone_Test.cpp HEADERS += \ Layers_Test.h \ - BaseTestCase.h + BaseTestCase.h \ + Camera_Test.h \ + NoiseGenerator_Test.h \ + PackStream_Test.h \ + Bruneton_Test.h \ + Clouds_Test.h \ + Euclid_Test.h \ + Render_Test.h \ + TerrainPainting_Test.h \ + Zone_Test.h win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../system/release/ -lpaysages_system else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../system/debug/ -lpaysages_system