diff --git a/test/test-automation/Makefile.in b/test/test-automation/Makefile.in index 62998f966..d2c60f17c 100644 --- a/test/test-automation/Makefile.in +++ b/test/test-automation/Makefile.in @@ -25,13 +25,16 @@ all: runner $(ALL_TESTS) runner: $(SRC) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ +asserts.o: asserts.c + $(CC) $(CFLAGS) -c $+ -o $@ + tests: $(ALL_TESTS) -libtest.so: test.o +libtest.so: test.o asserts.o $(CC) -shared -wl,-soname,$@ -o $@ $(LDFLAGS) $+ -test.o: $(TEST_SRC) - $(CC) -fPIC $(CFLAGS) -c $+ -o $@ +test.o: $(TEST_SRC) + $(CC) -fPIC $(CFLAGS) -c $+ -o $@ Makefile: Makefile.in config.status $(SHELL) /config.status $@ diff --git a/test/test-automation/asserts.h b/test/test-automation/asserts.h new file mode 100644 index 000000000..d0f74f9a9 --- /dev/null +++ b/test/test-automation/asserts.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2011 Markus Kauppila + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _ASSERTS_H +#define _ASSERTS_H + +#include + + +void assertEquals(Uint32 expected, Uint32 actual); + +#endif diff --git a/test/test-automation/test.c b/test/test-automation/test.c index 6d610f000..5d9dcf509 100644 --- a/test/test-automation/test.c +++ b/test/test-automation/test.c @@ -23,14 +23,21 @@ #include -char *names[] = {"hello", "hello2", "hello3"}; +#include -char **suite() { +#include "asserts.h" + +const char *names[] = {"hello", "hello2", "hello3"}; + +const char **suite() { return names; } void hello(void *arg){ - printf("hello\n"); + const char *revision = SDL_GetRevision(); + + printf("Revision is %s\n", revision); + assertEquals(3, 5); } void hello2(void *arg) { @@ -40,6 +47,8 @@ void hello2(void *arg) { void hello3(void *arg) { printf("hello\n"); + + assertEquals(3, 3); } #endif