aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-09-14 05:24:47 +0300
committereug-vs <eugene@eug-vs.xyz>2022-09-14 05:24:47 +0300
commit8e1d090e0f5c8d2e72fc1e90c22404a9ef808606 (patch)
tree4ac5838557f6906f1a2ccc7b26444e827f1b42dc
parentc6c53e253d2be076ab531cc14e00eb204f2cbb43 (diff)
downloadj1chess-8e1d090e0f5c8d2e72fc1e90c22404a9ef808606.tar.gz
fix: correctly display test subtotals
-rw-r--r--src/unittest.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/unittest.c b/src/unittest.c
index e4f7929..af81cd9 100644
--- a/src/unittest.c
+++ b/src/unittest.c
@@ -4,6 +4,7 @@
static int TOTAL = 0;
static int SECTION_TOTAL = 0;
+static int SECTION_NUMBER = 0;
static int SUCCESS = 0;
@@ -18,13 +19,14 @@ bool assert(bool expression, const char* message) {
void unit_test(bool expression, const char* subject) {
TOTAL++;
SECTION_TOTAL++;
- printf( "%d.%d %s: %s\n", TOTAL, SECTION_TOTAL, subject, expression? draw(GRN, PASS) : draw(RED, FAIL));
+ printf( "%d.%d %s: %s\n", SECTION_NUMBER, SECTION_TOTAL, subject, expression? draw(GRN, PASS) : draw(RED, FAIL));
if (expression) SUCCESS++;
}
void start_test_section(const char* name) {
- printf("%s %s %s\n", CYAN, name, RESET);
SECTION_TOTAL = 0;
+ SECTION_NUMBER++;
+ printf("%d.%s %s %s\n", SECTION_NUMBER, CYAN, name, RESET);
}
double coverage() {