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

summaryrefslogtreecommitdiffhomepage
path: root/tests/Progmasoft/BazelModule/OwnMain.tests.cpp
blob: 92c4d711068d5624d6b91ed9de91cc50e4aa73f7 (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
// Copyright (c) 2026 Progmasoft.
// SPDX-License-Identifier: LGPL-3.0-or-later

// Tests linked with @progmasoft_catch3//:catch3, with a main of their own.
#include <Progmasoft/Catch3/Session.hpp>
#include <Progmasoft/Catch3/TestMacros.hpp>
#include <algorithm>
#include <vector>

TEST_CASE("Sections run against a fresh fixture", "[module]")
{
    std::vector<int> values{ 3, 1, 2 };

    SECTION("sorting orders the values")
    {
        std::sort(values.begin(), values.end());
        REQUIRE(std::is_sorted(values.begin(), values.end()));
        CHECK(values.front() < values.back());
    }
    SECTION("each section starts from the same values")
    {
        CHECK_FALSE(std::is_sorted(values.begin(), values.end()));
    }
}

int
main(int argc, char **argv)
{
    Catch::Session session;
    return session.run(argc, argv);
}