Cute-Test / cdt-plugin

Eclipse CDT integration of the CUTE Unit Testing Framework
Eclipse Public License 2.0
0 stars 1 forks source link

Support testing suite nesting #7

Open tpecar opened 1 year ago

tpecar commented 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

#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

image