Open tpecar opened 1 year ago
Not sure to which degree this applies to the CUTE project itself, but here it goes.
The cgreen unit testing framework, which provides a CUTE compatible reporter, allows nesting of suites.
The example shown here
main
create_test_suite()
first_suite
second_suite
#include <cgreen/cgreen.h> Ensure(first_suite_test) { assert_true(1); } TestSuite *first_suite() { TestSuite *suite = create_test_suite(); add_test(suite, first_suite_test); /* could add more */ return suite; } Ensure(second_suite_test) { assert_true(1); } TestSuite *second_suite() { TestSuite *suite = create_test_suite(); add_test(suite, second_suite_test); /* could add more */ return suite; } int main(int argc, char **argv) { TestSuite *suite = create_test_suite(); add_suite(suite, first_suite()); add_suite(suite, second_suite()); TestReporter *reporter = create_cute_reporter(); return run_test_suite(suite, reporter); }
This generates the following output
#beginning main 2 #beginning first_suite 1 #starting first_suite_test #success first_suite_test, 535408 ms OK #ending first_suite #beginning second_suite 1 #starting second_suite_test #success second_suite_test, 535408 ms OK #ending second_suite #ending main: 2 passes, 0 failures, 0 exceptions, 1742 ms.
The plugin seems to parse the nesting, but it doesn't display the statistics correctly
Not sure to which degree this applies to the CUTE project itself, but here it goes.
The cgreen unit testing framework, which provides a CUTE compatible reporter, allows nesting of suites.
The example shown here
main
suite (thecreate_test_suite()
macro uses the name of the caller as suite name), andfirst_suite
andsecond_suite
to it.This generates the following output
The plugin seems to parse the nesting, but it doesn't display the statistics correctly