You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/02/17 16:00:45 UTC
[lucy-commits] [2/3] git commit: refs/heads/clownfish-test-v2 - Add some
documentation
Add some documentation
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e92327ce
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e92327ce
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e92327ce
Branch: refs/heads/clownfish-test-v2
Commit: e92327cea7c7b9f61597cc2d9327c29a9a99a56c
Parents: dd2369a
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Feb 17 15:39:38 2013 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun Feb 17 15:39:38 2013 +0100
----------------------------------------------------------------------
core/Clownfish/Test/Formatter/TestFormatterCF.cfh | 4 ++
core/Clownfish/Test/Formatter/TestFormatterTAP.cfh | 4 ++
core/Clownfish/Test/TestFormatter.cfh | 28 +++++++++++++++
core/Clownfish/Test/TestRunner.cfh | 23 ++++++++++++
core/Lucy/Test.cfh | 15 +++++++-
5 files changed, 73 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/e92327ce/core/Clownfish/Test/Formatter/TestFormatterCF.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/Formatter/TestFormatterCF.cfh b/core/Clownfish/Test/Formatter/TestFormatterCF.cfh
index 9cbaba6..ccf9267 100644
--- a/core/Clownfish/Test/Formatter/TestFormatterCF.cfh
+++ b/core/Clownfish/Test/Formatter/TestFormatterCF.cfh
@@ -16,6 +16,10 @@
parcel Lucy;
+/**
+ * A TestFormatter that produces human-readable output in a custom
+ * "Clownfish" format.
+ */
class Clownfish::Test::Formatter::TestFormatterCF
inherits Clownfish::Test::TestFormatter {
http://git-wip-us.apache.org/repos/asf/lucy/blob/e92327ce/core/Clownfish/Test/Formatter/TestFormatterTAP.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/Formatter/TestFormatterTAP.cfh b/core/Clownfish/Test/Formatter/TestFormatterTAP.cfh
index f8eeba1..969f9f6 100644
--- a/core/Clownfish/Test/Formatter/TestFormatterTAP.cfh
+++ b/core/Clownfish/Test/Formatter/TestFormatterTAP.cfh
@@ -16,6 +16,10 @@
parcel Lucy;
+/**
+ * A TestFormatter that produces TAP output (Test Anything Protocol).
+ * See http://testanything.org/
+ */
class Clownfish::Test::Formatter::TestFormatterTAP
inherits Clownfish::Test::TestFormatter {
http://git-wip-us.apache.org/repos/asf/lucy/blob/e92327ce/core/Clownfish/Test/TestFormatter.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/TestFormatter.cfh b/core/Clownfish/Test/TestFormatter.cfh
index cae9afe..3584ba8 100644
--- a/core/Clownfish/Test/TestFormatter.cfh
+++ b/core/Clownfish/Test/TestFormatter.cfh
@@ -16,6 +16,9 @@
parcel Lucy;
+/**
+ * Abstract base class for Clownfish test formatters.
+ */
abstract class Clownfish::Test::TestFormatter inherits Clownfish::Obj {
inert TestFormatter*
init(TestFormatter *self);
@@ -30,19 +33,44 @@ abstract class Clownfish::Test::TestFormatter inherits Clownfish::Obj {
inert void
batch_comment(void *vself, const char *fmt, ...);
+ /** Print output at the beginning of a test batch.
+ *
+ * @param batch The test batch.
+ */
abstract void
Batch_Prologue(TestFormatter *self, TestBatch *batch);
+ /** Print the result of a single test.
+ *
+ * @param pass True if the test passed, false otherwise.
+ * @param test_num The sequence number of the test.
+ * @param fmt printf-style format string.
+ * @param args Additional arguments.
+ */
abstract void
VTest_Result(TestFormatter *self, bool pass, uint32_t test_num,
const char *fmt, va_list args);
+ /** Print additional diagnosis for a test.
+ *
+ * @param fmt printf-style format string.
+ * @param args Additional arguments.
+ */
abstract void
VTest_Comment(TestFormatter *self, const char *fmt, va_list args);
+ /** Print additional diagnosis for a test batch.
+ *
+ * @param fmt printf-style format string.
+ * @param args Additional arguments.
+ */
abstract void
VBatch_Comment(TestFormatter *self, const char *fmt, va_list args);
+ /** Print test summary after running all test batches.
+ *
+ * @param runner The test runner.
+ */
abstract void
Summary(TestFormatter *self, TestRunner *runner);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/e92327ce/core/Clownfish/Test/TestRunner.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/TestRunner.cfh b/core/Clownfish/Test/TestRunner.cfh
index a5e8721..61a951c 100644
--- a/core/Clownfish/Test/TestRunner.cfh
+++ b/core/Clownfish/Test/TestRunner.cfh
@@ -16,6 +16,9 @@
parcel Lucy;
+/**
+ * Run multiple test batches and collect statistics.
+ */
class Clownfish::Test::TestRunner inherits Clownfish::Obj {
TestFormatter *formatter;
uint32_t num_tests;
@@ -26,27 +29,47 @@ class Clownfish::Test::TestRunner inherits Clownfish::Obj {
inert incremented TestRunner*
new(TestFormatter *formatter);
+ /**
+ * @param formatter The test formatter to format the test output.
+ */
inert TestRunner*
init(TestRunner *self, TestFormatter *formatter);
public void
Destroy(TestRunner *self);
+ /** Run a test batch and collect statistics.
+ *
+ * @param batch The test batch.
+ * @return true if the test batch passed.
+ */
bool
Run_Batch(TestRunner *self, TestBatch *batch);
+ /** Print a summary after running all test batches.
+ *
+ * @return true if any tests were run and all test batches passed.
+ */
bool
Finish(TestRunner *self);
+ /** Return the number of tests run.
+ */
uint32_t
Get_Num_Tests(TestRunner *self);
+ /** Return the number of failed tests.
+ */
uint32_t
Get_Num_Tests_Failed(TestRunner *self);
+ /** Return the number of test batches run.
+ */
uint32_t
Get_Num_Batches(TestRunner *self);
+ /** Return the number of failed test batches.
+ */
uint32_t
Get_Num_Batches_Failed(TestRunner *self);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/e92327ce/core/Lucy/Test.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test.cfh b/core/Lucy/Test.cfh
index 776a8c4..bdf11db 100644
--- a/core/Lucy/Test.cfh
+++ b/core/Lucy/Test.cfh
@@ -46,19 +46,32 @@ class Lucy::Test::TestBatch inherits Clownfish::Obj {
void
Plan(TestBatch *self);
+ /** Run the test batch and print test output and diagnosis.
+ *
+ * @return true if the test batch passed.
+ */
bool
Run(TestBatch *self);
- /* Will made be abstract later. */
+ /** Run the tests of the test batch.
+ *
+ * This method will made be abstract later.
+ */
void
Run_Tests(TestBatch *self);
+ /** Return the number of tests planned.
+ */
int64_t
Get_Num_Planned(TestBatch *self);
+ /** Return the number of tests run.
+ */
int64_t
Get_Num_Tests(TestBatch *self);
+ /** Return the number of failed tests.
+ */
int64_t
Get_Num_Failed(TestBatch *self);