Merged into one big app, while keeping modular applications also. gsoc2009_unit_tests
authorEdgar Simo <bobbens@gmail.com>
Sun, 02 Aug 2009 16:01:23 +0000
branchgsoc2009_unit_tests
changeset 3740 e451d5d288e9
parent 3739 651b261e591d
child 3741 808fad5fb593
Merged into one big app, while keeping modular applications also.
test/automated/Makefile
test/automated/platform/platform.c
test/automated/platform/platform.h
test/automated/render/render.c
test/automated/render/render.h
test/automated/rwops/rwops.c
test/automated/rwops/rwops.h
test/automated/surface/surface.c
test/automated/surface/surface.h
test/automated/testsdl.c
--- a/test/automated/Makefile	Sun Aug 02 15:49:55 2009 +0000
+++ b/test/automated/Makefile	Sun Aug 02 16:01:23 2009 +0000
@@ -7,6 +7,11 @@
 #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 @@
 .PHONY: all clean test
 
 
-all: $(TESTS_ALL)
+all: testsdl $(TESTS_ALL)
 
 test: all
 	@./rwops/rwops
@@ -24,17 +29,20 @@
 	@./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)
--- a/test/automated/platform/platform.c	Sun Aug 02 15:49:55 2009 +0000
+++ b/test/automated/platform/platform.c	Sun Aug 02 16:01:23 2009 +0000
@@ -131,10 +131,18 @@
 }
 
 
-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" );
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/automated/platform/platform.h	Sun Aug 02 16:01:23 2009 +0000
@@ -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 */
+
--- a/test/automated/render/render.c	Sun Aug 02 15:49:55 2009 +0000
+++ b/test/automated/render/render.c	Sun Aug 02 16:01:23 2009 +0000
@@ -951,10 +951,15 @@
  *  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;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/automated/render/render.h	Sun Aug 02 16:01:23 2009 +0000
@@ -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 */
+
--- a/test/automated/rwops/rwops.c	Sun Aug 02 15:49:55 2009 +0000
+++ b/test/automated/rwops/rwops.c	Sun Aug 02 16:01:23 2009 +0000
@@ -249,10 +249,15 @@
 /**
  * @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" );
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/automated/rwops/rwops.h	Sun Aug 02 16:01:23 2009 +0000
@@ -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 */
+
--- a/test/automated/surface/surface.c	Sun Aug 02 15:49:55 2009 +0000
+++ b/test/automated/surface/surface.c	Sun Aug 02 16:01:23 2009 +0000
@@ -545,10 +545,15 @@
 /**
  * @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;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/automated/surface/surface.h	Sun Aug 02 16:01:23 2009 +0000
@@ -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 */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/automated/testsdl.c	Sun Aug 02 16:01:23 2009 +0000
@@ -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;
+}
+