catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp
Martin Jeřábek cde3509664 Fix various useful clang-tidy warnings
* bugprone-branch-clone
* bugprone-copy-constructor-init
* bugprone-empty-catch
* bugprone-sizeof-expression
* bugprone-switch-missing-default-case
* bugprone-unused-local-non-trivial-variable
* clang-analyzer-core.uninitialized.Assign
* clang-analyzer-cplusplus.Move
* clang-analyzer-optin.cplusplus.VirtualCall
* modernize-loop-convert
* modernize-raw-string-literal
* modernize-use-equals-default
* modernize-use-override
* modernize-use-using
* performance-avoid-endl
* performance-inefficient-string-concatenation
* performance-inefficient-vector-operation
* performance-noexcept-move-constructor
* performance-unnecessary-value-param (and improve generator example)
* readability-duplicate-include
* readability-inconsistent-declaration-parameter-name
* readability-non-const-parameter
* readability-redundant-casting
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-static-accessed-through-instance
* unused variable in amalgamted tests
2024-03-01 21:24:45 +01:00

39 lines
950 B
C++

// Copyright Catch2 Authors
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
// SPDX-License-Identifier: BSL-1.0
/**\file
* This file serves as a simple compilation test against the amalgamated
* version of Catch2.
*/
#include "catch_amalgamated.hpp"
TEST_CASE("Just a dummy test") {
auto i = GENERATE(1, 2, 3);
SECTION("a") {
REQUIRE(i != 4);
}
SECTION("b") {
CHECK(i != 5);
}
REQUIRE_THAT(1,
Catch::Matchers::Predicate<int>([](int i) {
return i % 2 == 1;
}));
}
TEMPLATE_TEST_CASE("Trivial template test case", "", char, short) {
STATIC_REQUIRE(sizeof(TestType) <= sizeof(int));
}
TEST_CASE("Benchmark test", "[!benchmark]") {
BENCHMARK("Allocation benchmark") {
return std::vector<int>(10);
};
}