Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Converted libtest to a more proper dummy test suite (libtestdummy).

  • Loading branch information
mkauppila committed Jun 6, 2011
1 parent e11aef6 commit 2afa52f67ec1ff82c3da54f41a1c3436dbcf1aae
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I acinclude -I build-scripts

SUBDIRS = tests testrect
SUBDIRS = testdummy testrect

bin_PROGRAMS = runner
runner_SOURCES = runner.c SDL_test.c
@@ -9,12 +9,13 @@ runner_LDFLAGS = `sdl-config --libs`

install: install-tests
install-tests:
-cp -f tests/.libs/*.dylib tests/ 2> /dev/null
-cp -f tests/.libs/*.so tests/ 2> /dev/null
-mkdir tests
-cp -f testdummy/.libs/*.dylib tests/ 2> /dev/null
-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

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


@@ -33,7 +33,8 @@ CFLAGS="-g"
AC_FUNC_FORK

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

echo ""
@@ -53,9 +53,9 @@ char selected_suite_name[NAME_BUFFER_SIZE];

//!< Temporary array to hold test suite names
#if defined(linux) || defined( __linux)
char *testSuites[] = { "tests/libtest.so", "tests/libtestrect.so", NULL};
char *testSuites[] = { "tests/libtestdummy.so", "tests/libtestrect.so", NULL};
#else
char *testSuites[] = { "tests/libtest.dylib", "tests/libtestrect.dylib", NULL};
char *testSuites[] = { "tests/libtestdummy.dylib", "tests/libtestrect.dylib", NULL};
#endif


@@ -340,7 +340,7 @@ SuiteIsSelected(char *testSuiteName) {
int retVal = 1;

if(only_selected_suite) {
// extract the suite name. Rips the tests/ and file suffix from the suite name
// extract the suite name. Rips the tests/ and file extension from the suite name
char buffer[NAME_BUFFER_SIZE];
int len = strlen(testSuiteName);

@@ -0,0 +1,9 @@
lib_LTLIBRARIES = libtestdummy.la
libtestdummy_la_SOURCES = testdummy.c ../SDL_test.c
libtestdummy_la_CLAGS = -fPIC -g
libtestdummy_la_LDFLAGS = `sdl-config --libs`

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

@@ -18,6 +18,12 @@
3. This notice may not be removed or altered from any source distribution.
*/

/*! \file
* Dummy test suite for test runner. This can be used as a base for
* writing new tests. Dummy suite also works as reference to using
* various asserts and (possible) other utilities.
*/

#ifndef _TEST_C
#define _TEST_C

@@ -29,13 +35,13 @@

/* Test cases */
static const TestCaseReference test1 =
(TestCaseReference){ "hello", "description", TEST_ENABLED, 0 };
(TestCaseReference){ "dummycase1", "description", TEST_ENABLED, 0 };

static const TestCaseReference test2 =
(TestCaseReference){ "hello2", "description", TEST_ENABLED, 0 };
(TestCaseReference){ "dummycase2", "description", TEST_ENABLED, 0 };

static const TestCaseReference test3 =
(TestCaseReference){ "hello3", "description", TEST_ENABLED, 0 };
(TestCaseReference){ "dummycase3", "description", TEST_ENABLED, 0 };

/* Test suite */
extern const TestCaseReference *testSuite[] = {
@@ -48,7 +54,7 @@ TestCaseReference **QueryTestSuite() {
}

/* Test case functions */
void hello(void *arg)
void dummycase1(void *arg)
{
const char *revision = SDL_GetRevision();

@@ -57,14 +63,14 @@ void hello(void *arg)
AssertEquals(3, 5, "fails");
}

void hello2(void *arg)
void dummycase2(void *arg)
{
char *msg = "eello";
//msg[0] = 'H';
AssertTrue(0, "fails");
}

void hello3(void *arg)
void dummycase3(void *arg)
{
AssertTrue(1, "passes");
}

0 comments on commit 2afa52f

Please sign in to comment.