Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/Progmasoft/CoverageFixture.cpp
blob: a046a296d739d72ce37682fe0119ebfb44cffe74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2026 Progmasoft.
// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0

// A test binary built with coverage instrumentation, for the integration
// tests of `--coverage`: each test reaches lines the other does not. The
// markers at the ends of lines let the tests find those lines.

#include <Progmasoft/Catch3/TestMacros.hpp>

namespace
{
    int
    AddOne(int value)
    {
        return value + 1; // coverage: add-one
    }

    int
    SubtractOne(int value)
    {
        return value - 1; // coverage: subtract-one
    }
} // namespace

TEST_CASE("Adds one", "[coverage]")
{
    CHECK(AddOne(1) == 2);
}

TEST_CASE("Subtracts one", "[coverage]")
{
    CHECK(SubtractOne(1) == 0);
}