Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Ported platform tests, added AssertPass and AssertFail
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed Jun 18, 2011
1 parent b198b8f commit e0d9ee8
Show file tree
Hide file tree
Showing 6 changed files with 747 additions and 5 deletions.
5 changes: 3 additions & 2 deletions test/test-automation/Makefile.am
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I acinclude -I build-scripts

SUBDIRS = testdummy testrect
SUBDIRS = testdummy testrect testplatform

bin_PROGRAMS = runner
runner_SOURCES = runner.c SDL_test.c
Expand All @@ -14,8 +14,9 @@ install-tests:
-cp -f testdummy/.libs/*.so tests/ 2> /dev/null
-cp -f testrect/.libs/*.dylib tests/ 2> /dev/null
-cp -f testrect/.libs/*.so tests/ 2> /dev/null
-cp -f testplatform/.libs/*.dylib tests/ 2> /dev/null
-cp -f testplatform/.libs/*.so tests/ 2> /dev/null

distclean-local:
-rm -Rf tests/ docs/


36 changes: 34 additions & 2 deletions test/test-automation/SDL_test.c
Expand Up @@ -66,10 +66,11 @@ AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
va_start( args, message );
SDL_vsnprintf( buf, sizeof(buf), message, args );
va_end( args );
printf("Assert Equals failed: expected %d, got %d; %s\n", expected, actual, buf);
printf("AssertEquals failed: expected %d, got %d; %s\n", expected, actual, buf);
_testReturnValue = 1;
_testAssertsFailed++;
} else {
printf("AssertEquals passed\n");
_testAssertsPassed++;
}
}
Expand All @@ -85,12 +86,43 @@ AssertTrue(int condition, char *message, ...)
SDL_vsnprintf( buf, sizeof(buf), message, args );
va_end( args );

printf("Assert IsTrue failed: %s\n", buf);
printf("AssertTrue failed: %s\n", buf);
_testReturnValue = 1;
_testAssertsFailed++;
} else {
printf("AssertTrue passed\n");
_testAssertsPassed++;
}
}

void
AssertPass(char *message, ...)
{
va_list args;
char buf[256];

va_start( args, message );
SDL_vsnprintf( buf, sizeof(buf), message, args );
va_end( args );

printf("AssertPass: %s\n", buf);

_testAssertsPassed++;
}

void
AssertFail(char *message, ...)
{
va_list args;
char buf[256];

va_start( args, message );
SDL_vsnprintf( buf, sizeof(buf), message, args );
va_end( args );

printf("AssertFail: %s\n", buf);

_testAssertsFailed++;
}

#endif
3 changes: 2 additions & 1 deletion test/test-automation/configure.ac
Expand Up @@ -34,7 +34,8 @@ AC_FUNC_FORK

AC_CONFIG_FILES([Makefile
testdummy/Makefile
testrect/Makefile])
testrect/Makefile
testplatform/Makefile])
AC_OUTPUT

echo ""
Expand Down
9 changes: 9 additions & 0 deletions test/test-automation/testplatform/Makefile.am
@@ -0,0 +1,9 @@
lib_LTLIBRARIES = libtestplatform.la
libtestplatform_la_SOURCES = testplatform.c ../SDL_test.c
libtestplatform_la_CLAGS = -fPIC -g
libtestplatform_la_LDFLAGS = `sdl-config --libs`

distclean-local:
-rm *.dylib
-rm *.so

0 comments on commit e0d9ee8

Please sign in to comment.