Refactoring the massive main() to smaller functions.

--HG--
rename : test/test-automation/tests/asserts.c => test/test-automation/tests/SDL_test.c
rename : test/test-automation/tests/asserts.h => test/test-automation/tests/SDL_test.h
This commit is contained in:
Markus Kauppila 2011-05-26 18:38:56 +03:00
parent 4540a8a1b9
commit d6d8dec05e
7 changed files with 137 additions and 83 deletions

View file

@ -25,30 +25,42 @@
#include <SDL/SDL.h>
#include "asserts.h"
#include "SDL_test.h"
const char *names[] = {"hello", "hello2", "hello3"};
char *names[] = {"hello", "hello2", "hello3", NULL};
const char **suite() {
char **queryTestNames() {
return names;
}
void hello(void *arg){
TestInit();
const char *revision = SDL_GetRevision();
printf("Revision is %s\n", revision);
assertEquals("will fail", 3, 5);
AssertEquals("will fail", 3, 5);
TestQuit();
}
void hello2(void *arg) {
TestInit();
// why this isn't segfaulting?
char *msg = "eello";
msg[0] = 'H';
TestQuit();
}
void hello3(void *arg) {
printf("hello\n");
TestInit();
printf("hello3\n");
assertEquals("passes", 3, 3);
AssertEquals("passes", 3, 3);
TestQuit();
}
#endif