Skip to content

The result numbers can be incorrect when there are more than one test with the same name #703

@ILer32

Description

@ILer32

Problem
When there are more than one test with the same name,

  1. the results (test, failed test, asserts, passed, failed) can be incorrect.
  2. the formatting of the warning messages can be improved.

For example

#include <boost/ut.hpp>
    
int main(int argc, const char* argv[]) {
    using namespace boost::ut;

    "test 1"_test = [] {
        expect(1 == 1_i);
        expect(2 != 2_i); //false
    };
    "test 1"_test = [] {
        expect(3 == 3_i);
    };
}

Expected Behavior

UT starts =====================================================================
Running test "test 1"...
FAILED in: C:\Users\CIL\Desktop\Test folder\BoostUtTest\example.cpp:8 - test condition: [2 != 2]
===============================================================================
Suite global
tests:   2 | 1 failed
asserts: 3 | 2 passed | 1 failed
Completed =====================================================================

Actual Behavior

UT starts =====================================================================
Running test "test 1"...
FAILED in: ...\example.cpp:8 - test condition: [2 != 2]WARNING test 'test 1' for test suite 'global' already present

Running test "test 1"...
===============================================================================
Suite global
tests:   2 | 2 failed
asserts: 5 | 3 passed | 2 failed
Completed =====================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions