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 3740e451d5d288e9
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
     1.1 --- a/test/automated/Makefile	Sun Aug 02 15:49:55 2009 +0000
     1.2 +++ b/test/automated/Makefile	Sun Aug 02 16:01:23 2009 +0000
     1.3 @@ -7,6 +7,11 @@
     1.4  #CFLAGS  := -I. -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/local/include/SDL
     1.5  #LDFLAGS := -lm -ldl -lesd -lpthread
     1.6  
     1.7 +SRC         	:= testsdl.c \
     1.8 +						rwops/rwops.c \
     1.9 +						platform/platform.c \
    1.10 +						surface/surface.c \
    1.11 +						render/render.c
    1.12  COMMON_SRC     := SDL_at.c common/common.c
    1.13  COMMON_INCLUDE := SDL_at.h
    1.14  
    1.15 @@ -16,7 +21,7 @@
    1.16  .PHONY: all clean test
    1.17  
    1.18  
    1.19 -all: $(TESTS_ALL)
    1.20 +all: testsdl $(TESTS_ALL)
    1.21  
    1.22  test: all
    1.23  	@./rwops/rwops
    1.24 @@ -24,17 +29,20 @@
    1.25  	@./surface/surface
    1.26  	@./render/render
    1.27  
    1.28 +testsdl:
    1.29 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(SRC) $(COMMON_SRC)
    1.30 +
    1.31  rwops/rwops: rwops/rwops.c $(COMMON_INCLUDE) $(COMMON_SRC)
    1.32 -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rwops/rwops.c $(COMMON_SRC)
    1.33 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rwops/rwops.c $(COMMON_SRC) -DTEST_STANDALONE
    1.34  
    1.35  platform/platform: platform/platform.c $(COMMON_INCLUDE) $(COMMON_SRC)
    1.36 -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ platform/platform.c $(COMMON_SRC)
    1.37 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ platform/platform.c $(COMMON_SRC) -DTEST_STANDALONE
    1.38  
    1.39  surface/surface: surface/surface.c $(COMMON_INCLUDE) $(COMMON_SRC)
    1.40 -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ surface/surface.c $(COMMON_SRC)
    1.41 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ surface/surface.c $(COMMON_SRC) -DTEST_STANDALONE
    1.42  
    1.43  render/render: render/render.c $(COMMON_INCLUDE) $(COMMON_SRC)
    1.44 -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ render/render.c $(COMMON_SRC)
    1.45 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ render/render.c $(COMMON_SRC) -DTEST_STANDALONE
    1.46  
    1.47  clean:
    1.48  	$(RM) $(TESTS_ALL)
     2.1 --- a/test/automated/platform/platform.c	Sun Aug 02 15:49:55 2009 +0000
     2.2 +++ b/test/automated/platform/platform.c	Sun Aug 02 16:01:23 2009 +0000
     2.3 @@ -131,10 +131,18 @@
     2.4  }
     2.5  
     2.6  
     2.7 -int main(int argc, char *argv[])
     2.8 +/**
     2.9 + * @brief Platform test entrypoint.
    2.10 + */
    2.11 +#ifdef TEST_STANDALONE
    2.12 +int main( int argc, const char *argv[] )
    2.13  {
    2.14     (void) argc;
    2.15     (void) argv;
    2.16 +#else /* TEST_STANDALONE */
    2.17 +int test_platform (void)
    2.18 +{
    2.19 +#endif /* TEST_STANDALONE */
    2.20  
    2.21     SDL_ATinit( "Platform" );
    2.22  
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/automated/platform/platform.h	Sun Aug 02 16:01:23 2009 +0000
     3.3 @@ -0,0 +1,18 @@
     3.4 +/**
     3.5 + * Part of SDL test suite.
     3.6 + *
     3.7 + * Written by Edgar Simo "bobbens"
     3.8 + *
     3.9 + * Released under Public Domain.
    3.10 + */
    3.11 +
    3.12 +
    3.13 +#ifndef _TEST_PLATFORM
    3.14 +#  define _TEST_PLATFORM
    3.15 +
    3.16 +
    3.17 +int test_platform (void);
    3.18 +
    3.19 +
    3.20 +#endif /* _TEST_PLATFORM */
    3.21 +
     4.1 --- a/test/automated/render/render.c	Sun Aug 02 15:49:55 2009 +0000
     4.2 +++ b/test/automated/render/render.c	Sun Aug 02 16:01:23 2009 +0000
     4.3 @@ -951,10 +951,15 @@
     4.4   *  give issues. Don't like that very much, but no way around without creating
     4.5   *  superfluous testsuites.
     4.6   */
     4.7 +#ifdef TEST_STANDALONE
     4.8  int main( int argc, const char *argv[] )
     4.9  {
    4.10     (void) argc;
    4.11     (void) argv;
    4.12 +#else /* TEST_STANDALONE */
    4.13 +int test_render (void)
    4.14 +{
    4.15 +#endif /* TEST_STANDALONE */
    4.16     int i, j, nd, nr;
    4.17     int ret;
    4.18     const char *driver, *str;
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/automated/render/render.h	Sun Aug 02 16:01:23 2009 +0000
     5.3 @@ -0,0 +1,18 @@
     5.4 +/**
     5.5 + * Part of SDL test suite.
     5.6 + *
     5.7 + * Written by Edgar Simo "bobbens"
     5.8 + *
     5.9 + * Released under Public Domain.
    5.10 + */
    5.11 +
    5.12 +
    5.13 +#ifndef _TEST_RENDER
    5.14 +#  define _TEST_RENDER
    5.15 +
    5.16 +
    5.17 +int test_render (void);
    5.18 +
    5.19 +
    5.20 +#endif /* _TEST_RENDER */
    5.21 +
     6.1 --- a/test/automated/rwops/rwops.c	Sun Aug 02 15:49:55 2009 +0000
     6.2 +++ b/test/automated/rwops/rwops.c	Sun Aug 02 16:01:23 2009 +0000
     6.3 @@ -249,10 +249,15 @@
     6.4  /**
     6.5   * @brief Entry point.
     6.6   */
     6.7 +#ifdef TEST_STANDALONE
     6.8  int main( int argc, const char *argv[] )
     6.9  {
    6.10     (void) argc;
    6.11     (void) argv;
    6.12 +#else /* TEST_STANDALONE */
    6.13 +int test_rwops (void)
    6.14 +{
    6.15 +#endif /* TEST_STANDALONE */
    6.16  
    6.17     SDL_ATinit( "SDL_RWops" );
    6.18  
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/automated/rwops/rwops.h	Sun Aug 02 16:01:23 2009 +0000
     7.3 @@ -0,0 +1,18 @@
     7.4 +/**
     7.5 + * Part of SDL test suite.
     7.6 + *
     7.7 + * Written by Edgar Simo "bobbens"
     7.8 + *
     7.9 + * Released under Public Domain.
    7.10 + */
    7.11 +
    7.12 +
    7.13 +#ifndef _TEST_RWOPS
    7.14 +#  define _TEST_RWOPS
    7.15 +
    7.16 +
    7.17 +int test_rwops (void);
    7.18 +
    7.19 +
    7.20 +#endif /* _TEST_RWOPS */
    7.21 +
     8.1 --- a/test/automated/surface/surface.c	Sun Aug 02 15:49:55 2009 +0000
     8.2 +++ b/test/automated/surface/surface.c	Sun Aug 02 16:01:23 2009 +0000
     8.3 @@ -545,10 +545,15 @@
     8.4  /**
     8.5   * @brief Entry point.
     8.6   */
     8.7 +#ifdef TEST_STANDALONE
     8.8  int main( int argc, const char *argv[] )
     8.9  {
    8.10     (void) argc;
    8.11     (void) argv;
    8.12 +#else /* TEST_STANDALONE */
    8.13 +int test_surface (void)
    8.14 +{
    8.15 +#endif /* TEST_STANDALONE */
    8.16     int ret;
    8.17     SDL_Surface *testsur;
    8.18  
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/automated/surface/surface.h	Sun Aug 02 16:01:23 2009 +0000
     9.3 @@ -0,0 +1,18 @@
     9.4 +/**
     9.5 + * Part of SDL test suite.
     9.6 + *
     9.7 + * Written by Edgar Simo "bobbens"
     9.8 + *
     9.9 + * Released under Public Domain.
    9.10 + */
    9.11 +
    9.12 +
    9.13 +#ifndef _TEST_SURFACE
    9.14 +#  define _TEST_SURFACE
    9.15 +
    9.16 +
    9.17 +int test_surface (void);
    9.18 +
    9.19 +
    9.20 +#endif /* _TEST_SURFACE */
    9.21 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/test/automated/testsdl.c	Sun Aug 02 16:01:23 2009 +0000
    10.3 @@ -0,0 +1,28 @@
    10.4 +/*
    10.5 + * SDL test suite framework code.
    10.6 + *
    10.7 + * Written by Edgar Simo "bobbens"
    10.8 + *
    10.9 + * Released under Public Domain.
   10.10 + */
   10.11 +
   10.12 +
   10.13 +#include "platform/platform.h"
   10.14 +#include "rwops/rwops.h"
   10.15 +#include "surface/surface.h"
   10.16 +#include "render/render.h"
   10.17 +
   10.18 +
   10.19 +int main( int argc, char *argv[] )
   10.20 +{
   10.21 +   (void) argc;
   10.22 +   (void) argv;
   10.23 +
   10.24 +   test_platform();
   10.25 +   test_rwops();
   10.26 +   test_surface();
   10.27 +   test_render();
   10.28 +
   10.29 +   return 0;
   10.30 +}
   10.31 +