-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
bugSomething isn't workingSomething isn't working
Description
If I compile the follow sample code
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
// Simple function to test
int add(int a, int b) {
return a + b;
}
int multiply(int a, int b) {
return a * b;
}
// Tests
TEST_CASE("testing the add() function") {
CHECK(add(2, 2) == 4); // passes
CHECK(add(-1, 1) == 0); // passes
CHECK(add(2, 3) == 6); // fails
}
TEST_CASE("testing the multiply() function") {
CHECK(multiply(2, 3) == 6); // passes
CHECK(multiply(2, 0) == 2); // fails
}
and run it I get the following output
./a.out
[doctest] doctest version is "2.4.11"
[doctest] run with "--help" for options
===============================================================================
./main.cpp:14:
TEST CASE: testing the add() function
./main.cpp:17: ERROR: CHECK( add(2, 3) == 6 ) is NOT correct!
values: CHECK( 5 == 6 )
===============================================================================
./main.cpp:20:
TEST CASE: testing the multiply() function
./main.cpp:22: ERROR: CHECK( multiply(2, 0) == 2 ) is NOT correct!
values: CHECK( 0 == 2 )
===============================================================================
[doctest] test cases: 2 | 0 passed | 2 failed | 0 skipped
[doctest] assertions: 5 | 3 passed | 2 failed |
[doctest] Status: FAILURE!
This shows that doctest can show what assertions fail. The issue with xeus-cpps tests are that when assertions fails, it doesn't show exactly which ones do (just a summary of how many failed at the end). This suggests that the way xeus-cpps doctest tests are coded, it suppresses the useful error output about which assertions fail.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working