corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmke...@apache.org
Subject [87/92] [abbrv] incubator-corinthia git commit: Provision for plain and data test types
Date Wed, 17 Dec 2014 13:29:37 GMT
Provision for plain and data test types


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/f1db47e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/f1db47e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/f1db47e2

Branch: refs/heads/stable
Commit: f1db47e25342b9d5d66903c5630733bc26e375ce
Parents: 4701058
Author: Peter Kelly <peter@uxproductivity.com>
Authored: Wed Dec 10 00:29:46 2014 +0700
Committer: Peter Kelly <peter@uxproductivity.com>
Committed: Wed Dec 10 00:39:05 2014 +0700

----------------------------------------------------------------------
 DocFormats/api/tests/APITests.c                 | 10 ++---
 DocFormats/core/tests/css/CSSTests.c            |  4 +-
 DocFormats/core/tests/html/HTMLTests.c          |  4 +-
 DocFormats/core/tests/lib/LibTests.c            |  4 +-
 DocFormats/core/tests/xml/XMLTests.c            |  4 +-
 DocFormats/filters/latex/tests/LaTeXTests.c     |  4 +-
 DocFormats/filters/odf/tests/ODFTests.c         |  4 +-
 DocFormats/filters/ooxml/tests/word/WordTests.c |  4 +-
 DocFormats/platform/tests/PlatformTests.c       |  4 +-
 DocFormats/unittest/DFUnitTest.c                |  2 +-
 DocFormats/unittest/DFUnitTest.h                | 41 +++++++++++++++++++-
 consumers/dftest/src/main.c                     |  3 +-
 12 files changed, 64 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/api/tests/APITests.c
----------------------------------------------------------------------
diff --git a/DocFormats/api/tests/APITests.c b/DocFormats/api/tests/APITests.c
index 217fb5d..57659b4 100644
--- a/DocFormats/api/tests/APITests.c
+++ b/DocFormats/api/tests/APITests.c
@@ -37,10 +37,10 @@ static void test_api_four(void)
 
 TestGroup APITests = {
     "api", {
-        { "one", test_api_one },
-        { "two", test_api_two },
-        { "three", test_api_three },
-        { "four", test_api_four },
-        { NULL, NULL },
+        { "one", PlainTest, test_api_one },
+        { "two", PlainTest, test_api_two },
+        { "three", PlainTest, test_api_three },
+        { "four", PlainTest, test_api_four },
+        { NULL, PlainTest, NULL },
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/core/tests/css/CSSTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/tests/css/CSSTests.c b/DocFormats/core/tests/css/CSSTests.c
index 6764b6a..99944b5 100644
--- a/DocFormats/core/tests/css/CSSTests.c
+++ b/DocFormats/core/tests/css/CSSTests.c
@@ -21,7 +21,7 @@ static void test_sample(void)
 
 TestGroup CSSTests = {
     "core.css", {
-        { "sample", test_sample },
-        { NULL, NULL }
+        { "sample", PlainTest, test_sample },
+        { NULL, PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/core/tests/html/HTMLTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/tests/html/HTMLTests.c b/DocFormats/core/tests/html/HTMLTests.c
index 6ce53a8..2b50f48 100644
--- a/DocFormats/core/tests/html/HTMLTests.c
+++ b/DocFormats/core/tests/html/HTMLTests.c
@@ -21,7 +21,7 @@ static void test_sample(void)
 
 TestGroup HTMLTests = {
     "core.html", {
-        { "sample", test_sample },
-        { NULL, NULL }
+        { "sample", PlainTest, test_sample },
+        { NULL, PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/core/tests/lib/LibTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/tests/lib/LibTests.c b/DocFormats/core/tests/lib/LibTests.c
index a5870b4..cbf3bc7 100644
--- a/DocFormats/core/tests/lib/LibTests.c
+++ b/DocFormats/core/tests/lib/LibTests.c
@@ -21,7 +21,7 @@ static void test_sample(void)
 
 TestGroup LibTests = {
     "core.lib", {
-        { "sample", test_sample },
-        { NULL, NULL }
+        { "sample", PlainTest, test_sample },
+        { NULL, PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/core/tests/xml/XMLTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/tests/xml/XMLTests.c b/DocFormats/core/tests/xml/XMLTests.c
index fdb6592..a7ca32b 100644
--- a/DocFormats/core/tests/xml/XMLTests.c
+++ b/DocFormats/core/tests/xml/XMLTests.c
@@ -21,7 +21,7 @@ static void test_sample(void)
 
 TestGroup XMLTests = {
     "core.xml", {
-        { "sample", test_sample },
-        { NULL, NULL }
+        { "sample", PlainTest, test_sample },
+        { NULL, PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/filters/latex/tests/LaTeXTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/latex/tests/LaTeXTests.c b/DocFormats/filters/latex/tests/LaTeXTests.c
index 88e50c5..3a25a3a 100644
--- a/DocFormats/filters/latex/tests/LaTeXTests.c
+++ b/DocFormats/filters/latex/tests/LaTeXTests.c
@@ -21,7 +21,7 @@ static void test_sample(void)
 
 TestGroup LaTeXTests = {
     "latex", {
-        { "sample", test_sample },
-        { NULL, NULL }
+        { "sample", PlainTest, test_sample },
+        { NULL, PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/filters/odf/tests/ODFTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/odf/tests/ODFTests.c b/DocFormats/filters/odf/tests/ODFTests.c
index 6fb013a..9af04e8 100644
--- a/DocFormats/filters/odf/tests/ODFTests.c
+++ b/DocFormats/filters/odf/tests/ODFTests.c
@@ -21,7 +21,7 @@ static void test_sample(void)
 
 TestGroup ODFTests = {
     "odf", {
-        { "sample", test_sample },
-        { NULL, NULL }
+        { "sample", PlainTest, test_sample },
+        { NULL, PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/filters/ooxml/tests/word/WordTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/tests/word/WordTests.c b/DocFormats/filters/ooxml/tests/word/WordTests.c
index ee37413..89fed2c 100644
--- a/DocFormats/filters/ooxml/tests/word/WordTests.c
+++ b/DocFormats/filters/ooxml/tests/word/WordTests.c
@@ -21,7 +21,7 @@ static void test_sample(void)
 
 TestGroup WordTests = {
     "word", {
-        { "sample", test_sample },
-        { NULL, NULL }
+        { "sample", PlainTest, test_sample },
+        { NULL, PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/platform/tests/PlatformTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/tests/PlatformTests.c b/DocFormats/platform/tests/PlatformTests.c
index 7a060cf..b792dc3 100644
--- a/DocFormats/platform/tests/PlatformTests.c
+++ b/DocFormats/platform/tests/PlatformTests.c
@@ -21,7 +21,7 @@ static void test_sample(void)
 
 TestGroup PlatformTests = {
     "platform", {
-        { "sample", test_sample },
-        { NULL, NULL }
+        { "sample", PlainTest, test_sample },
+        { NULL, PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/unittest/DFUnitTest.c
----------------------------------------------------------------------
diff --git a/DocFormats/unittest/DFUnitTest.c b/DocFormats/unittest/DFUnitTest.c
index 3283441..f6c951d 100644
--- a/DocFormats/unittest/DFUnitTest.c
+++ b/DocFormats/unittest/DFUnitTest.c
@@ -48,7 +48,7 @@ static void runGroup(TestGroup *group)
     }
 }
 
-void utrun(TestGroup **groups)
+void utrun(TestGroup **groups, int plain, int data, const char **filenames)
 {
     for (int i = 0; groups[i]; i++)
         runGroup(groups[i]);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/DocFormats/unittest/DFUnitTest.h
----------------------------------------------------------------------
diff --git a/DocFormats/unittest/DFUnitTest.h b/DocFormats/unittest/DFUnitTest.h
index 7b375d1..ff93f83 100644
--- a/DocFormats/unittest/DFUnitTest.h
+++ b/DocFormats/unittest/DFUnitTest.h
@@ -15,11 +15,50 @@
 #ifndef DocFormats_DFUnitTest_h
 #define DocFormats_DFUnitTest_h
 
+/*
+ 
+ There are two types of tests: plain tests and data tests. The former are entirely self-contained;
+ they consist of a C function that takes no input and produces no output; simply calling
functions
+ like utassert(), utexpect(), and utfail() to trigger success or failure. These are intended
for
+ testing functionality that requires no or only trivial amounts of input data.
+ 
+ Data tests are for functions which need to be called multiple times with different input
values,
+ read from files. The input data comes from the *.test files included in the various modules,
the
+ first line of each indicating the name of the test function that should be called, as well
as
+ optional parameters. A data test retrieves these parameters and/or input data, and acts
upon it.
+ Typically, part of the input data for the test will include the expected output of the test,
which
+ can be checked by calling utexpect().
+ 
+ The tests are triggered by the dftest function, which can be run in three modes:
+ 
+ dftest plain
+ dftest data <path>
+ dftest all <path>
+ 
+ When run in 'plain' mode, only the plain tests requiring no input files are executed. When
run in
+ 'data' mode, the specified path will be searched for all files with the extension .test,
and the
+ functions indicated in the first line of those files will be called. A given function may
be called
+ multiple times, since each test file corresponds to one test execution. The 'all' mode does
both
+ plain and data tests.
+ 
+ All test groups defined in the various source files in test/ directories must be explicitly
+ referenced from main.c in dftest, as this is where it gets the references to the set of
available
+ groups. These are passed to utrun, so it can determine what tests it needs to execute based
on
+ the plain and data parameters.
+
+ */
+
+typedef enum {
+    PlainTest,
+    DataTest,
+} TestType;
+
 typedef struct TestCase TestCase;
 typedef struct TestGroup TestGroup;
 
 struct TestCase {
     const char *name;
+    TestType type;
     void (*fun)(void);
 };
 
@@ -30,7 +69,7 @@ struct TestGroup {
 
 // Functions to be called by the test harness
 
-void utrun(TestGroup **groups);
+void utrun(TestGroup **groups, int plain, int data, const char **filenames);
 
 // Functions to be called from within test cases
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f1db47e2/consumers/dftest/src/main.c
----------------------------------------------------------------------
diff --git a/consumers/dftest/src/main.c b/consumers/dftest/src/main.c
index 590eb23..dbf6447 100644
--- a/consumers/dftest/src/main.c
+++ b/consumers/dftest/src/main.c
@@ -41,6 +41,7 @@ TestGroup *groups[] = {
 int main(int argc, const char **argv)
 {
     setbuf(stdout,NULL);
-    utrun(groups);
+    // For now, just run the 'plain' tests.
+    utrun(groups,1,0,NULL);
     return 0;
 }


Mime
View raw message