Change type of test counts from int64_t to uint32_t
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a1de7787 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a1de7787 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a1de7787 Branch: refs/heads/clownfish-test-v2 Commit: a1de778733c4a0015a7d1fc3c1943747376c109a Parents: fa5fa2c Author: Nick Wellnhofer <[email protected]> Authored: Mon Feb 18 20:03:37 2013 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Mon Feb 18 20:14:56 2013 +0100 ---------------------------------------------------------------------- core/Clownfish/Test/TestFormatter.c | 6 +++--- core/Lucy/Test.c | 22 +++++++++++----------- core/Lucy/Test.cfh | 20 ++++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/a1de7787/core/Clownfish/Test/TestFormatter.c ---------------------------------------------------------------------- diff --git a/core/Clownfish/Test/TestFormatter.c b/core/Clownfish/Test/TestFormatter.c index b4aead0..6a93404 100644 --- a/core/Clownfish/Test/TestFormatter.c +++ b/core/Clownfish/Test/TestFormatter.c @@ -75,7 +75,7 @@ void TestFormatterCF_batch_prologue(TestFormatterCF *self, TestBatch *batch) { UNUSED_VAR(self); CharBuf *class_name = TestBatch_Get_Class_Name(batch); - printf("Testing %s...\n", CB_Get_Ptr8(class_name)); + printf("Running %s...\n", CB_Get_Ptr8(class_name)); } void @@ -144,7 +144,7 @@ TestFormatterTAP_init(TestFormatterTAP *self) { void TestFormatterTAP_batch_prologue(TestFormatterTAP *self, TestBatch *batch) { UNUSED_VAR(self); - printf("1..%" PRId64 "\n", TestBatch_Get_Num_Planned(batch)); + printf("1..%u\n", TestBatch_Get_Num_Planned(batch)); } void @@ -153,7 +153,7 @@ TestFormatterTAP_vtest_result(TestFormatterTAP *self, bool pass, va_list args) { UNUSED_VAR(self); const char *result = pass ? "ok" : "not ok"; - printf("%s %d - ", result, test_num); + printf("%s %u - ", result, test_num); vprintf(fmt, args); printf("\n"); } http://git-wip-us.apache.org/repos/asf/lucy/blob/a1de7787/core/Lucy/Test.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test.c b/core/Lucy/Test.c index 370a933..1d0048e 100644 --- a/core/Lucy/Test.c +++ b/core/Lucy/Test.c @@ -218,15 +218,15 @@ Test_run_all_batches(TestFormatter *formatter) { } TestBatch* -TestBatch_new(int64_t num_tests) { +TestBatch_new(uint32_t num_planned) { TestBatch *self = (TestBatch*)VTable_Make_Obj(TESTBATCH); - return TestBatch_init(self, num_tests); + return TestBatch_init(self, num_planned); } TestBatch* -TestBatch_init(TestBatch *self, int64_t num_tests) { +TestBatch_init(TestBatch *self, uint32_t num_planned) { // Assign. - self->num_tests = num_tests; + self->num_planned = num_planned; // Initialize. self->formatter = (TestFormatter*)TestFormatterTAP_new(); @@ -262,28 +262,28 @@ TestBatch_run(TestBatch *self) { TestFormatter_batch_comment(self->formatter, "%d/%d tests failed.\n", self->num_failed, self->test_num); } - if (self->test_num != self->num_tests) { + if (self->test_num != self->num_planned) { failed = true; TestFormatter_batch_comment(self->formatter, "Bad plan: You planned %d tests but ran" " %d.\n", - self->num_tests, self->test_num); + self->num_planned, self->test_num); } return !failed; } -int64_t +uint32_t TestBatch_get_num_planned(TestBatch *self) { - return self->num_tests; + return self->num_planned; } -int64_t +uint32_t TestBatch_get_num_tests(TestBatch *self) { return self->test_num; } -int64_t +uint32_t TestBatch_get_num_failed(TestBatch *self) { return self->num_failed; } @@ -434,7 +434,7 @@ void TestBatch_vskip(TestBatch *self, const char *pattern, va_list args) { self->test_num++; // TODO: Add a VTest_Skip method to TestFormatter - TestFormatter_VTest_Result(self->formatter, true, self->num_tests, + TestFormatter_VTest_Result(self->formatter, true, self->test_num, pattern, args); self->num_skipped++; } http://git-wip-us.apache.org/repos/asf/lucy/blob/a1de7787/core/Lucy/Test.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Test.cfh b/core/Lucy/Test.cfh index cfda123..6788c5f 100644 --- a/core/Lucy/Test.cfh +++ b/core/Lucy/Test.cfh @@ -28,17 +28,17 @@ inert class Lucy::Test { abstract class Lucy::Test::TestBatch inherits Clownfish::Obj { TestFormatter *formatter; - int64_t test_num; - int64_t num_tests; - int64_t num_passed; - int64_t num_failed; - int64_t num_skipped; + uint32_t test_num; + uint32_t num_planned; + uint32_t num_passed; + uint32_t num_failed; + uint32_t num_skipped; inert incremented TestBatch* - new(int64_t num_tests); + new(uint32_t num_planned); inert TestBatch* - init(TestBatch *self, int64_t num_tests); + init(TestBatch *self, uint32_t num_planned); public void Destroy(TestBatch *self); @@ -57,17 +57,17 @@ abstract class Lucy::Test::TestBatch inherits Clownfish::Obj { /** Return the number of tests planned. */ - int64_t + uint32_t Get_Num_Planned(TestBatch *self); /** Return the number of tests run. */ - int64_t + uint32_t Get_Num_Tests(TestBatch *self); /** Return the number of failed tests. */ - int64_t + uint32_t Get_Num_Failed(TestBatch *self); inert bool
