Skip to content

Commit

Permalink
Merge pull request #101 from fdefelici/release_v2.4.4
Browse files Browse the repository at this point in the history
Release v2.4.4
  • Loading branch information
fdefelici authored Apr 21, 2024
2 parents bd77018 + b07927d commit 11e49b0
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clove-unit.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* clove-unit
* v2.4.3
* v2.4.4
* Single-Header Unit Testing library for C/C++
* https://github.com/fdefelici/clove-unit
*
Expand All @@ -10,8 +10,8 @@

#define __CLOVE_VERSION_MAJOR 2
#define __CLOVE_VERSION_MINOR 4
#define __CLOVE_VERSION_PATCH 3
#define __CLOVE_VERSION "2.4.3"
#define __CLOVE_VERSION_PATCH 4
#define __CLOVE_VERSION "2.4.4"

//Preventing "unknown-pragmas" warning on GCC <= 12 for '#pragma region' usage
//NOTE1: GCC and G++ v13+ support '#pragma region' by the way.
Expand Down Expand Up @@ -2662,7 +2662,7 @@ void __clove_report_pretty_start(__clove_report_t* _this, __clove_vector_t* suit
size_t longest_suite_and_test_name = 0;
__CLOVE_VECTOR_FOREACH(suites, __clove_suite_t, each_suite, {
size_t suite_length = __clove_string_length(each_suite->name);
__CLOVE_VECTOR_FOREACH(suites, __clove_test_t, each_test, {
__CLOVE_VECTOR_FOREACH(&each_suite->tests, __clove_test_t, each_test, {
size_t test_length = __clove_string_length(each_test->name);

if (longest_suite_and_test_name < suite_length + test_length) {
Expand Down
84 changes: 84 additions & 0 deletions tests/functs/src/unit/report_pretty_full_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,87 @@ CLOVE_TEST(ReportTwoSuitesWithTenTests) {

CLOVE_STRING_EQ(expected, actual);
}

CLOVE_TEST(ReportWithTestIdentifierLength45) {
__clove_suite_t suite = create_suite("Suite12345");
__clove_test_t test11 = create_test("Suite12345_Test1234567890__1234567");

suite_add_test(&suite, &test11);
__CLOVE_VECTOR_ADD(&suites, __clove_suite_t, suite);

__clove_report_t* base = (__clove_report_t*)report;
base->start(base, &suites, 1);
base->begin_suite(base, &suite, 0);
base->end_test(base, &suite, &test11, 1);
base->end_suite(base, &suite, 0);
base->end(base, 1, 0, 0);

const char* expected =
"[INFO] Executing Test Runner with detail level: 'Full'\n"
"[INFO] Suites / Tests found: 1 / 1\n"
"[INFO] 1) Suite12345.Suite12345_Test1234567890__1234567.....[PASS] (0.000 ms)\n"
"[INFO] Total: 1, Passed: 1, Failed: 0, Skipped: 0\n"
"[INFO] Run duration: 0 ms\n"
"[INFO] Run result: SUCCESS :-)\n"
;

char* actual = __clove_stream_memory_as_string(stream);

CLOVE_STRING_EQ(expected, actual);
}

CLOVE_TEST(ReportWithTestIdentifierLength48) {
__clove_suite_t suite = create_suite("Suite12345");
__clove_test_t test11 = create_test("Suite12345_Test1234567890__1234567890");

suite_add_test(&suite, &test11);
__CLOVE_VECTOR_ADD(&suites, __clove_suite_t, suite);

__clove_report_t* base = (__clove_report_t*)report;
base->start(base, &suites, 1);
base->begin_suite(base, &suite, 0);
base->end_test(base, &suite, &test11, 1);
base->end_suite(base, &suite, 0);
base->end(base, 1, 0, 0);

const char* expected =
"[INFO] Executing Test Runner with detail level: 'Full'\n"
"[INFO] Suites / Tests found: 1 / 1\n"
"[INFO] 1) Suite12345.Suite12345_Test1234567890__1234567890...[PASS] (0.000 ms)\n"
"[INFO] Total: 1, Passed: 1, Failed: 0, Skipped: 0\n"
"[INFO] Run duration: 0 ms\n"
"[INFO] Run result: SUCCESS :-)\n"
;

char* actual = __clove_stream_memory_as_string(stream);

CLOVE_STRING_EQ(expected, actual);
}

CLOVE_TEST(ReportWithTestIdentifierLength50) {
__clove_suite_t suite = create_suite("Suite12345");
__clove_test_t test11 = create_test("Suite12345_Test1234567890__123456789012");

suite_add_test(&suite, &test11);
__CLOVE_VECTOR_ADD(&suites, __clove_suite_t, suite);

__clove_report_t* base = (__clove_report_t*)report;
base->start(base, &suites, 1);
base->begin_suite(base, &suite, 0);
base->end_test(base, &suite, &test11, 1);
base->end_suite(base, &suite, 0);
base->end(base, 1, 0, 0);

const char* expected =
"[INFO] Executing Test Runner with detail level: 'Full'\n"
"[INFO] Suites / Tests found: 1 / 1\n"
"[INFO] 1) Suite12345.Suite12345_Test1234567890__123456789012...[PASS] (0.000 ms)\n"
"[INFO] Total: 1, Passed: 1, Failed: 0, Skipped: 0\n"
"[INFO] Run duration: 0 ms\n"
"[INFO] Run result: SUCCESS :-)\n"
;

char* actual = __clove_stream_memory_as_string(stream);

CLOVE_STRING_EQ(expected, actual);
}

0 comments on commit 11e49b0

Please sign in to comment.