From 3e9b0cca46ea29aff1dad13a07f8de4c04a59d0e Mon Sep 17 00:00:00 2001 From: Edgar Simo Date: Sun, 2 Aug 2009 16:01:23 +0000 Subject: [PATCH] Merged into one big app, while keeping modular applications also. --- test/automated/Makefile | 18 +++++++++++++----- test/automated/platform/platform.c | 10 +++++++++- test/automated/platform/platform.h | 18 ++++++++++++++++++ test/automated/render/render.c | 5 +++++ test/automated/render/render.h | 18 ++++++++++++++++++ test/automated/rwops/rwops.c | 5 +++++ test/automated/rwops/rwops.h | 18 ++++++++++++++++++ test/automated/surface/surface.c | 5 +++++ test/automated/surface/surface.h | 18 ++++++++++++++++++ test/automated/testsdl.c | 28 ++++++++++++++++++++++++++++ 10 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 test/automated/platform/platform.h create mode 100644 test/automated/render/render.h create mode 100644 test/automated/rwops/rwops.h create mode 100644 test/automated/surface/surface.h create mode 100644 test/automated/testsdl.c diff --git a/test/automated/Makefile b/test/automated/Makefile index 1d77a27a5..306715376 100644 --- a/test/automated/Makefile +++ b/test/automated/Makefile @@ -7,6 +7,11 @@ LDFLAGS := `sdl-config --libs` #CFLAGS := -I. -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/local/include/SDL #LDFLAGS := -lm -ldl -lesd -lpthread +SRC := testsdl.c \ + rwops/rwops.c \ + platform/platform.c \ + surface/surface.c \ + render/render.c COMMON_SRC := SDL_at.c common/common.c COMMON_INCLUDE := SDL_at.h @@ -16,7 +21,7 @@ TESTS_ALL := rwops/rwops platform/platform surface/surface render/render .PHONY: all clean test -all: $(TESTS_ALL) +all: testsdl $(TESTS_ALL) test: all @./rwops/rwops @@ -24,17 +29,20 @@ test: all @./surface/surface @./render/render +testsdl: + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(SRC) $(COMMON_SRC) + rwops/rwops: rwops/rwops.c $(COMMON_INCLUDE) $(COMMON_SRC) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rwops/rwops.c $(COMMON_SRC) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rwops/rwops.c $(COMMON_SRC) -DTEST_STANDALONE platform/platform: platform/platform.c $(COMMON_INCLUDE) $(COMMON_SRC) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ platform/platform.c $(COMMON_SRC) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ platform/platform.c $(COMMON_SRC) -DTEST_STANDALONE surface/surface: surface/surface.c $(COMMON_INCLUDE) $(COMMON_SRC) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ surface/surface.c $(COMMON_SRC) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ surface/surface.c $(COMMON_SRC) -DTEST_STANDALONE render/render: render/render.c $(COMMON_INCLUDE) $(COMMON_SRC) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ render/render.c $(COMMON_SRC) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ render/render.c $(COMMON_SRC) -DTEST_STANDALONE clean: $(RM) $(TESTS_ALL) diff --git a/test/automated/platform/platform.c b/test/automated/platform/platform.c index 6fa0ddf7b..d7c0cb9bb 100644 --- a/test/automated/platform/platform.c +++ b/test/automated/platform/platform.c @@ -131,10 +131,18 @@ static void plat_testEndian (void) } -int main(int argc, char *argv[]) +/** + * @brief Platform test entrypoint. + */ +#ifdef TEST_STANDALONE +int main( int argc, const char *argv[] ) { (void) argc; (void) argv; +#else /* TEST_STANDALONE */ +int test_platform (void) +{ +#endif /* TEST_STANDALONE */ SDL_ATinit( "Platform" ); diff --git a/test/automated/platform/platform.h b/test/automated/platform/platform.h new file mode 100644 index 000000000..d8310e0c0 --- /dev/null +++ b/test/automated/platform/platform.h @@ -0,0 +1,18 @@ +/** + * Part of SDL test suite. + * + * Written by Edgar Simo "bobbens" + * + * Released under Public Domain. + */ + + +#ifndef _TEST_PLATFORM +# define _TEST_PLATFORM + + +int test_platform (void); + + +#endif /* _TEST_PLATFORM */ + diff --git a/test/automated/render/render.c b/test/automated/render/render.c index 9ca45bb2a..ae6859dbe 100644 --- a/test/automated/render/render.c +++ b/test/automated/render/render.c @@ -951,10 +951,15 @@ int render_runTests (void) * give issues. Don't like that very much, but no way around without creating * superfluous testsuites. */ +#ifdef TEST_STANDALONE int main( int argc, const char *argv[] ) { (void) argc; (void) argv; +#else /* TEST_STANDALONE */ +int test_render (void) +{ +#endif /* TEST_STANDALONE */ int i, j, nd, nr; int ret; const char *driver, *str; diff --git a/test/automated/render/render.h b/test/automated/render/render.h new file mode 100644 index 000000000..316f22013 --- /dev/null +++ b/test/automated/render/render.h @@ -0,0 +1,18 @@ +/** + * Part of SDL test suite. + * + * Written by Edgar Simo "bobbens" + * + * Released under Public Domain. + */ + + +#ifndef _TEST_RENDER +# define _TEST_RENDER + + +int test_render (void); + + +#endif /* _TEST_RENDER */ + diff --git a/test/automated/rwops/rwops.c b/test/automated/rwops/rwops.c index aa79d94e9..b7e3fa132 100644 --- a/test/automated/rwops/rwops.c +++ b/test/automated/rwops/rwops.c @@ -249,10 +249,15 @@ static void rwops_testFP (void) /** * @brief Entry point. */ +#ifdef TEST_STANDALONE int main( int argc, const char *argv[] ) { (void) argc; (void) argv; +#else /* TEST_STANDALONE */ +int test_rwops (void) +{ +#endif /* TEST_STANDALONE */ SDL_ATinit( "SDL_RWops" ); diff --git a/test/automated/rwops/rwops.h b/test/automated/rwops/rwops.h new file mode 100644 index 000000000..676e7f886 --- /dev/null +++ b/test/automated/rwops/rwops.h @@ -0,0 +1,18 @@ +/** + * Part of SDL test suite. + * + * Written by Edgar Simo "bobbens" + * + * Released under Public Domain. + */ + + +#ifndef _TEST_RWOPS +# define _TEST_RWOPS + + +int test_rwops (void); + + +#endif /* _TEST_RWOPS */ + diff --git a/test/automated/surface/surface.c b/test/automated/surface/surface.c index d3b746366..06ddec105 100644 --- a/test/automated/surface/surface.c +++ b/test/automated/surface/surface.c @@ -545,10 +545,15 @@ void surface_runTests( SDL_Surface *testsur ) /** * @brief Entry point. */ +#ifdef TEST_STANDALONE int main( int argc, const char *argv[] ) { (void) argc; (void) argv; +#else /* TEST_STANDALONE */ +int test_surface (void) +{ +#endif /* TEST_STANDALONE */ int ret; SDL_Surface *testsur; diff --git a/test/automated/surface/surface.h b/test/automated/surface/surface.h new file mode 100644 index 000000000..cc1c89846 --- /dev/null +++ b/test/automated/surface/surface.h @@ -0,0 +1,18 @@ +/** + * Part of SDL test suite. + * + * Written by Edgar Simo "bobbens" + * + * Released under Public Domain. + */ + + +#ifndef _TEST_SURFACE +# define _TEST_SURFACE + + +int test_surface (void); + + +#endif /* _TEST_SURFACE */ + diff --git a/test/automated/testsdl.c b/test/automated/testsdl.c new file mode 100644 index 000000000..215d5aec9 --- /dev/null +++ b/test/automated/testsdl.c @@ -0,0 +1,28 @@ +/* + * SDL test suite framework code. + * + * Written by Edgar Simo "bobbens" + * + * Released under Public Domain. + */ + + +#include "platform/platform.h" +#include "rwops/rwops.h" +#include "surface/surface.h" +#include "render/render.h" + + +int main( int argc, char *argv[] ) +{ + (void) argc; + (void) argv; + + test_platform(); + test_rwops(); + test_surface(); + test_render(); + + return 0; +} +