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

Commit

Permalink
Converted libtest to a more proper dummy test suite (libtestdummy).
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed Jun 6, 2011
1 parent e11aef6 commit 2afa52f
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 556 deletions.
9 changes: 5 additions & 4 deletions test/test-automation/Makefile.am
@@ -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
Expand All @@ -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/


3 changes: 2 additions & 1 deletion test/test-automation/configure.ac
Expand Up @@ -33,7 +33,8 @@ CFLAGS="-g"
AC_FUNC_FORK

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

echo ""
Expand Down
6 changes: 3 additions & 3 deletions test/test-automation/runner.c
Expand Up @@ -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


Expand Down Expand Up @@ -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);

Expand Down
9 changes: 9 additions & 0 deletions test/test-automation/testdummy/Makefile.am
@@ -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

Expand Up @@ -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

Expand All @@ -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[] = {
Expand All @@ -48,7 +54,7 @@ TestCaseReference **QueryTestSuite() {
}

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

Expand All @@ -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");
}
Expand Down

0 comments on commit 2afa52f

Please sign in to comment.