Browse Source

Can run unit tests as build target

Thomas Buck 10 years ago
parent
commit
77b8e82432
6 changed files with 23 additions and 12 deletions
  1. 0
    4
      CMakeLists.txt
  2. 1
    1
      README.md
  3. 15
    0
      test/CMakeLists.txt
  4. 1
    1
      test/GLString.cpp
  5. 1
    1
      test/Sound.cpp
  6. 5
    5
      test/tga.cpp

+ 0
- 4
CMakeLists.txt View File

23
 add_subdirectory (src)
23
 add_subdirectory (src)
24
 add_subdirectory (test)
24
 add_subdirectory (test)
25
 
25
 
26
-# Add test target
27
-add_custom_target (tests)
28
-add_dependencies (tests GLStringTest MathTest MatrixTest NetworkTest SoundTest TGATest TombRaiderTest)
29
-
30
 # Preparing the bundle on install
26
 # Preparing the bundle on install
31
 # http://www.cmake.org/Wiki/BundleUtilitiesExample
27
 # http://www.cmake.org/Wiki/BundleUtilitiesExample
32
 # Why does it even work?
28
 # Why does it even work?

+ 1
- 1
README.md View File

67
 
67
 
68
 On Mac OS X, running `make install` will produce a distributable OpenRaider.app bundle.
68
 On Mac OS X, running `make install` will produce a distributable OpenRaider.app bundle.
69
 
69
 
70
-To build all Unit Tests, run `make tests`.
70
+To build all Unit Tests, run `make tests`, to run most of them use `make testRun`.
71
 
71
 
72
 ## Usage
72
 ## Usage
73
 
73
 

+ 15
- 0
test/CMakeLists.txt View File

115
 
115
 
116
 #################################################################
116
 #################################################################
117
 
117
 
118
+# Add test build target
119
+add_custom_target (tests)
120
+add_dependencies (tests GLStringTest MathTest MatrixTest NetworkTest SoundTest TGATest TombRaiderTest)
121
+
122
+# Add test run target
123
+add_custom_target (testRun echo "Running Unit Tests..."
124
+    COMMAND TGATest
125
+    COMMAND SoundTest
126
+    COMMAND MatrixTest
127
+    COMMAND MathTest
128
+    COMMAND GLStringTest
129
+)
130
+add_dependencies (testRun tests)
131
+
132
+
118
 #TEST_MAP_TR5=~/.OpenRaider/paks/tr5/demo.trc
133
 #TEST_MAP_TR5=~/.OpenRaider/paks/tr5/demo.trc
119
 #TEST_MAP_TR4=~/.OpenRaider/paks/tr4/angkor1.tr4
134
 #TEST_MAP_TR4=~/.OpenRaider/paks/tr4/angkor1.tr4
120
 #TEST_MAP_TR3=~/.OpenRaider/paks/tr3/scotland.tr2
135
 #TEST_MAP_TR3=~/.OpenRaider/paks/tr3/scotland.tr2

+ 1
- 1
test/GLString.cpp View File

107
     gTexture.setFlag(Texture::fUseMipmaps);
107
     gTexture.setFlag(Texture::fUseMipmaps);
108
     gTexture.setMaxTextureCount(32);
108
     gTexture.setMaxTextureCount(32);
109
 
109
 
110
-    gTexture.loadFontTTF("../data/test.ttf", 32, 126 - 32);  // ASCII
110
+    gTexture.loadFontTTF("../../data/test.ttf", 32, 126 - 32);  // ASCII
111
 
111
 
112
     TEXT->Init(4);
112
     TEXT->Init(4);
113
     i = TEXT->glPrintf(50, 50, "OpenRaider GLString");
113
     i = TEXT->glPrintf(50, 50, "OpenRaider GLString");

+ 1
- 1
test/Sound.cpp View File

12
 
12
 
13
 #include "greatest.h"
13
 #include "greatest.h"
14
 
14
 
15
-#define TESTFILE "../data/sample.wav"
15
+#define TESTFILE "../../data/sample.wav"
16
 
16
 
17
 Sound sound;
17
 Sound sound;
18
 bool inited = false;
18
 bool inited = false;

+ 5
- 5
test/tga.cpp View File

11
 
11
 
12
 //! \todo generate list?
12
 //! \todo generate list?
13
 const char *testFiles[] = {
13
 const char *testFiles[] = {
14
-    "../data/particle.tga",
15
-    "../data/snow.tga",
16
-    "../data/snow2.tga",
17
-    "../data/splash.tga",
18
-    "../data/white.tga"
14
+    "../../data/particle.tga",
15
+    "../../data/snow.tga",
16
+    "../../data/snow2.tga",
17
+    "../../data/splash.tga",
18
+    "../../data/white.tga"
19
 };
19
 };
20
 
20
 
21
 TEST checkFile(FILE *f) {
21
 TEST checkFile(FILE *f) {

Loading…
Cancel
Save