Added TestCaseReference structure.
authorMarkus Kauppila <markus.kauppila@gmail.com>
Thu, 26 May 2011 19:19:46 +0300
changeset 5668 3a9b790c00e9
parent 5667 4c0d0d32414c
child 5669 d6873237c96d
Added TestCaseReference structure.
test/test-automation/runner.c
test/test-automation/tests/SDL_test.c
test/test-automation/tests/SDL_test.h
test/test-automation/tests/test.c
--- a/test/test-automation/runner.c	Thu May 26 18:38:56 2011 +0300
+++ b/test/test-automation/runner.c	Thu May 26 19:19:46 2011 +0300
@@ -43,18 +43,18 @@
 	return library;
 }
 
-char **QueryTestCases(void *library) {
-	char **(*suite)(void);
+TestCaseReference **QueryTestCases(void *library) {
+	TestCaseReference **(*suite)(void);
 
-	suite = (char **(*)(void)) SDL_LoadFunction(library, "queryTestNames");
+	suite = (TestCaseReference **(*)(void)) SDL_LoadFunction(library, "QueryTestCaseReferences");
 	if(suite == NULL) {
-		printf("Quering test names failed, suite == NULL\n");
+		printf("Loading QueryTestCaseReferences() failed.\n");
 		printf("%s\n", SDL_GetError());
 	}
 
-	char **tests = suite();
+	TestCaseReference **tests = suite();
 	if(tests == NULL) {
-		printf("Failed to load test cases. tests == NULL\n");
+		printf("Failed to load test references.\n");
 		printf("%s\n", SDL_GetError());
 	}
 
@@ -99,7 +99,14 @@
 	const Uint32 startTicks = SDL_GetTicks();
 
 	void *library = LoadLibrary();
-	char **tests = QueryTestCases(library);
+	TestCaseReference **tests = QueryTestCases(library);
+	if(tests == NULL) {
+		printf("It's null\n");
+	} else {
+		printf("It's NOT null\n");
+	}
+	printf("%s name\n", tests[1]->name);
+
 
 	for(testname = tests[counter]; testname; testname = tests[++counter]) {
 		printf("Running %s (in %s):\n", testname, libName);
--- a/test/test-automation/tests/SDL_test.c	Thu May 26 18:38:56 2011 +0300
+++ b/test/test-automation/tests/SDL_test.c	Thu May 26 19:19:46 2011 +0300
@@ -43,7 +43,7 @@
 AssertEquals(char *message, Uint32 expected, Uint32 actual)
 {
 	if(expected != actual) {
-		printf("\n===============================\n");
+		printf("===============================\n");
 		printf("Assert failed: %s\n", message);
 		printf("Expected %d, got %d\n", expected, actual);
 		printf("===============================\n");
@@ -51,4 +51,5 @@
 	}
 }
 
+
 #endif
--- a/test/test-automation/tests/SDL_test.h	Thu May 26 18:38:56 2011 +0300
+++ b/test/test-automation/tests/SDL_test.h	Thu May 26 19:19:46 2011 +0300
@@ -23,6 +23,13 @@
 
 #include <SDL/SDL.h>
 
+typedef struct TestCaseReference {
+	int enabled;       /* Set to TEST_ENABLED or TEST_DISABLED */
+	long requirements;  /* Set to TEST_REQUIRES_OPENGL, TEST_REQUIRES_AUDIO, ... */
+	char *name;         /* "Func2Stress" */
+	char *description;  /* "This test beats the crap out of func2()" */
+} TestCaseReference;
+
 void TestInit();
 void TestQuit();
 
--- a/test/test-automation/tests/test.c	Thu May 26 18:38:56 2011 +0300
+++ b/test/test-automation/tests/test.c	Thu May 26 19:19:46 2011 +0300
@@ -27,10 +27,22 @@
 
 #include "SDL_test.h"
 
-char *names[] = {"hello", "hello2", "hello3", NULL};
+/*
+TestCaseReference references[] =  {
+		{.name = "hello", .description = "desc", .enabled = 1, .requirements = 0 }
+};
+*/
+
 
-char **queryTestNames() {
-	return names;
+TestCaseReference *references[] =  {
+		{"hello", "description", 1, 0},
+		{"hello2", "description", 1, 0},
+		NULL
+};
+
+
+TestCaseReference **QueryTestCaseReferences() {
+	return references;
 }
 
 void hello(void *arg){