catch2 Questions

4

I am trying to do Catch2 Unit Testing in Visual Studio. I have created a small test project to practice. When I try to compile this test project, I get a linker error. I am now trying to diagnose t...
Wasteful asked 21/10, 2020 at 7:56

2

Solved

I am using Catch v2.13.1 What is the correct way to compare float values. I thought the below would fail, but both pass. REQUIRE(1147332687.7189338 == Approx(1147332688.4281545).margin(0.0001)); RE...
Lx asked 29/9, 2020 at 13:57

2

Solved

Can I run test cases based on "not matching" a particular tag in Catch2? TEST_CASE("Check the data validity","[Working]"){ REQUIRE(true); } TEST_CASE("Check the input","[InProgress]"){ REQUIRE(...
Waistband asked 14/2, 2019 at 15:10

1

Solved

I am using Catch2 from the actual devel branch and I have a linker error when trying to compare two vector<string_view> The issue can be reproduced as following: #include <vector> #incl...
Macnamara asked 16/2, 2021 at 15:23

1

I am writing a dll which supports interfacing with both C and C++ language applications. The dll itself is written in C++, so the question is can i use Catch2 framework for unittesting both C and C...
Schizont asked 7/6, 2021 at 17:14

1

Solved

all. I decided to use the new cmake macro to download external dependencies. I took the sample code from the documentation for the Catch2 library. include(FetchContent) FetchContent_Declare( Catc...
Maiden asked 5/5, 2021 at 20:29

2

Solved

I am trying to install Catch2 on ubuntu 20.04. Used instruction from here. This is what i do: $ git clone https://github.com/catchorg/Catch2.git $ cd Catch2 $ cmake -Bbuild -H. -DBUILD_TESTING=OFF ...
Anabranch asked 1/12, 2020 at 21:13

1

Solved

Catch2 and Boost.Test provide similar features for writing unit tests. For a certain project I have to use Boost.Test instead of Catch2. The problem I have is that both use different format outputs...
Geisler asked 31/10, 2020 at 5:54

0

I don't seem to get my CTest project to recognize my Catch2 tests. The test project itself builds fine and I manage to run the tests using the executable created by it. However when running ctest -...
Persas asked 6/4, 2020 at 22:17

2

Solved

I have a simple unit-test using Catch 2.11.1: #define CATCH_CONFIG_MAIN #include "catch.hpp" #include <utility> #include <any> namespace A::B { namespace C { struct S { }; } u...
Fiske asked 16/1, 2020 at 13:20

1

Solved

I'm new to unit testing in C++ and want to get some advice on this. I use Visual Studio 2019 for development and I chose Catch2 as my testing library, I also got the Test Adapter for Catch2 install...
Nagaland asked 8/1, 2020 at 11:57

1

Solved

I have a project built with CMake that uses Catch2 for unit tests. Some of the unit tests exercise code that loads data from a file like this: std::string resource_dir = "TEST_CWD/resources/"; std...
Shakedown asked 11/1, 2020 at 0:48

1

Solved

Some parts of QT rely on the event loop being up and running (or at least generate warnings otherwise). How do you integrate Catch2 tests with the QT event loop?
Profession asked 12/6, 2019 at 20:10

0

I added my own command line option using a custom main file†: †https://github.com/catchorg/Catch2/blob/master/docs/own-main.md#adding-your-own-command-line-options // ... auto cli...
Reliable asked 5/6, 2019 at 14:37

2

Solved

I have the following project structure: test_main.cc #define CATCH_CONFIG_MAIN #include "catch2.hpp" test1.cc #include "catch2.hpp" #include "test_utils.hpp" TEST_CASE("test1", "[test1]") { ...
Twill asked 14/3, 2019 at 22:14
1

© 2022 - 2024 — McMap. All rights reserved.