Port a single test to new infrastructure
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e15e8697 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e15e8697 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e15e8697 Branch: refs/heads/clownfish-test-v2 Commit: e15e8697d57ce0e70e9a8179720f8f74815fc062 Parents: ce6c0f5 Author: Nick Wellnhofer <[email protected]> Authored: Sun Feb 17 00:37:05 2013 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Sun Feb 17 01:41:28 2013 +0100 ---------------------------------------------------------------------- core/Lucy/Test.c | 3 +++ core/Lucy/Test/Highlight/TestHeatMap.c | 21 ++++++++++++++------- core/Lucy/Test/Highlight/TestHeatMap.cfh | 14 +++++++++++--- perl/buildlib/Lucy/Build/Binding/Misc.pm | 3 --- perl/t/core/310-heat_map.t | 2 +- 5 files changed, 29 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/e15e8697/core/Lucy/Test.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test.c b/core/Lucy/Test.c index 3640989..020e89d 100644 --- a/core/Lucy/Test.c +++ b/core/Lucy/Test.c @@ -26,6 +26,7 @@ #include "Clownfish/Test/Formatter/TestFormatterTAP.h" #include "Clownfish/Test/TestFormatter.h" #include "Clownfish/Test/TestRunner.h" +#include "Lucy/Test/Highlight/TestHeatMap.h" static bool S_vtest_true(TestBatch *self, bool condition, const char *pattern, @@ -35,6 +36,8 @@ static VArray* S_all_test_batches() { VArray *batches = VA_new(0); + VA_Push(batches, (Obj*)TestHeatMap_new()); + return batches; } http://git-wip-us.apache.org/repos/asf/lucy/blob/e15e8697/core/Lucy/Test/Highlight/TestHeatMap.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Highlight/TestHeatMap.c b/core/Lucy/Test/Highlight/TestHeatMap.c index 02919b1..081d8c7 100644 --- a/core/Lucy/Test/Highlight/TestHeatMap.c +++ b/core/Lucy/Test/Highlight/TestHeatMap.c @@ -22,6 +22,18 @@ #include "Lucy/Search/Span.h" +TestHeatMap* +TestHeatMap_new() { + TestHeatMap *self = (TestHeatMap*)VTable_Make_Obj(TESTHEATMAP); + return TestHeatMap_init(self); +} + +TestHeatMap* +TestHeatMap_init(TestHeatMap *self) { + return (TestHeatMap*)TestBatch_init((TestBatch*)self, 13); +} + + static void test_calc_proximity_boost(TestBatch *batch) { VArray *spans = VA_new(0); @@ -159,15 +171,10 @@ test_flatten_spans(TestBatch *batch) { } void -TestHeatMap_run_tests() { - TestBatch *batch = TestBatch_new(13); - - TestBatch_Plan(batch); - +TestHeatMap_run(TestHeatMap *self) { + TestBatch *batch = (TestBatch*)self; test_calc_proximity_boost(batch); test_flatten_spans(batch); - - DECREF(batch); } http://git-wip-us.apache.org/repos/asf/lucy/blob/e15e8697/core/Lucy/Test/Highlight/TestHeatMap.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Highlight/TestHeatMap.cfh b/core/Lucy/Test/Highlight/TestHeatMap.cfh index 70f65bd..37d127a 100644 --- a/core/Lucy/Test/Highlight/TestHeatMap.cfh +++ b/core/Lucy/Test/Highlight/TestHeatMap.cfh @@ -16,9 +16,17 @@ parcel Lucy; -inert class Lucy::Test::Highlight::TestHeatMap { - inert void - run_tests(); +class Lucy::Test::Highlight::TestHeatMap + inherits Lucy::Test::TestBatch { + + inert incremented TestHeatMap* + new(); + + inert TestHeatMap* + init(TestHeatMap *self); + + void + Run(TestHeatMap *self); } http://git-wip-us.apache.org/repos/asf/lucy/blob/e15e8697/perl/buildlib/Lucy/Build/Binding/Misc.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm index f49768a..535dc7b 100644 --- a/perl/buildlib/Lucy/Build/Binding/Misc.pm +++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm @@ -300,9 +300,6 @@ PPCODE: lucy_TestVArray_run_tests(); } // Lucy::Highlight - else if (strEQ(package, "TestHeatMap")) { - lucy_TestHeatMap_run_tests(); - } else if (strEQ(package, "TestHighlighter")) { lucy_TestHighlighter_run_tests(); } http://git-wip-us.apache.org/repos/asf/lucy/blob/e15e8697/perl/t/core/310-heat_map.t ---------------------------------------------------------------------- diff --git a/perl/t/core/310-heat_map.t b/perl/t/core/310-heat_map.t index 1195e85..6472677 100644 --- a/perl/t/core/310-heat_map.t +++ b/perl/t/core/310-heat_map.t @@ -17,5 +17,5 @@ use strict; use warnings; use Lucy::Test; -Lucy::Test::run_tests("TestHeatMap"); +Lucy::Test::run_tests("Lucy::Test::Highlight::TestHeatMap");
