Commit d9ce7a4a authored by Markus Kauppila's avatar Markus Kauppila

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

parent 6346ed9c
ACLOCAL_AMFLAGS = -I acinclude -I build-scripts ACLOCAL_AMFLAGS = -I acinclude -I build-scripts
SUBDIRS = tests testrect SUBDIRS = testdummy testrect
bin_PROGRAMS = runner bin_PROGRAMS = runner
runner_SOURCES = runner.c SDL_test.c runner_SOURCES = runner.c SDL_test.c
...@@ -9,12 +9,13 @@ runner_LDFLAGS = `sdl-config --libs` ...@@ -9,12 +9,13 @@ runner_LDFLAGS = `sdl-config --libs`
install: install-tests install: install-tests
install-tests: install-tests:
-cp -f tests/.libs/*.dylib tests/ 2> /dev/null -mkdir tests
-cp -f tests/.libs/*.so tests/ 2> /dev/null -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/*.dylib tests/ 2> /dev/null
-cp -f testrect/.libs/*.so tests/ 2> /dev/null -cp -f testrect/.libs/*.so tests/ 2> /dev/null
distclean-local: distclean-local:
-rm -Rf docs/ -rm -Rf tests/ docs/
...@@ -33,7 +33,8 @@ CFLAGS="-g" ...@@ -33,7 +33,8 @@ CFLAGS="-g"
AC_FUNC_FORK AC_FUNC_FORK
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
tests/Makefile testrect/Makefile]) testdummy/Makefile
testrect/Makefile])
AC_OUTPUT AC_OUTPUT
echo "" echo ""
......
...@@ -53,9 +53,9 @@ char selected_suite_name[NAME_BUFFER_SIZE]; ...@@ -53,9 +53,9 @@ char selected_suite_name[NAME_BUFFER_SIZE];
//!< Temporary array to hold test suite names //!< Temporary array to hold test suite names
#if defined(linux) || defined( __linux) #if defined(linux) || defined( __linux)
char *testSuites[] = { "tests/libtest.so", "tests/libtestrect.so", NULL}; char *testSuites[] = { "tests/libtestdummy.so", "tests/libtestrect.so", NULL};
#else #else
char *testSuites[] = { "tests/libtest.dylib", "tests/libtestrect.dylib", NULL}; char *testSuites[] = { "tests/libtestdummy.dylib", "tests/libtestrect.dylib", NULL};
#endif #endif
...@@ -340,7 +340,7 @@ SuiteIsSelected(char *testSuiteName) { ...@@ -340,7 +340,7 @@ SuiteIsSelected(char *testSuiteName) {
int retVal = 1; int retVal = 1;
if(only_selected_suite) { 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]; char buffer[NAME_BUFFER_SIZE];
int len = strlen(testSuiteName); int len = strlen(testSuiteName);
......
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 @@ ...@@ -18,6 +18,12 @@
3. This notice may not be removed or altered from any source distribution. 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 #ifndef _TEST_C
#define _TEST_C #define _TEST_C
...@@ -29,13 +35,13 @@ ...@@ -29,13 +35,13 @@
/* Test cases */ /* Test cases */
static const TestCaseReference test1 = static const TestCaseReference test1 =
(TestCaseReference){ "hello", "description", TEST_ENABLED, 0 }; (TestCaseReference){ "dummycase1", "description", TEST_ENABLED, 0 };
static const TestCaseReference test2 = static const TestCaseReference test2 =
(TestCaseReference){ "hello2", "description", TEST_ENABLED, 0 }; (TestCaseReference){ "dummycase2", "description", TEST_ENABLED, 0 };
static const TestCaseReference test3 = static const TestCaseReference test3 =
(TestCaseReference){ "hello3", "description", TEST_ENABLED, 0 }; (TestCaseReference){ "dummycase3", "description", TEST_ENABLED, 0 };
/* Test suite */ /* Test suite */
extern const TestCaseReference *testSuite[] = { extern const TestCaseReference *testSuite[] = {
...@@ -48,7 +54,7 @@ TestCaseReference **QueryTestSuite() { ...@@ -48,7 +54,7 @@ TestCaseReference **QueryTestSuite() {
} }
/* Test case functions */ /* Test case functions */
void hello(void *arg) void dummycase1(void *arg)
{ {
const char *revision = SDL_GetRevision(); const char *revision = SDL_GetRevision();
...@@ -57,14 +63,14 @@ void hello(void *arg) ...@@ -57,14 +63,14 @@ void hello(void *arg)
AssertEquals(3, 5, "fails"); AssertEquals(3, 5, "fails");
} }
void hello2(void *arg) void dummycase2(void *arg)
{ {
char *msg = "eello"; char *msg = "eello";
//msg[0] = 'H'; //msg[0] = 'H';
AssertTrue(0, "fails"); AssertTrue(0, "fails");
} }
void hello3(void *arg) void dummycase3(void *arg)
{ {
AssertTrue(1, "passes"); AssertTrue(1, "passes");
} }
......
This diff is collapsed.
lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = test.c ../SDL_test.c
libtest_la_CLAGS = -fPIC -g
libtest_la_LDFLAGS = `sdl-config --libs`
distclean-local:
-rm *.dylib
-rm *.so
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment