Skip to content

Commit fb1534d

Browse files
committed
Add Catch2 main functions
1 parent c9d9288 commit fb1534d

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

benchmarks/Catch2Main.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// All test files are included in the executable via the Glob in CMakeLists.txt
2+
3+
#include "juce_gui_basics/juce_gui_basics.h"
4+
#include <catch2/catch_session.hpp>
5+
6+
int main (int argc, char* argv[])
7+
{
8+
// This lets us use JUCE's MessageManager without leaking.
9+
// PluginProcessor might need this if you use the APVTS for example.
10+
// You'll also need it for tests that rely on juce::Graphics, juce::Timer, etc.
11+
// It's nicer DX when placed here vs. manually in Catch2 SECTIONs
12+
juce::ScopedJuceInitialiser_GUI gui;
13+
14+
const int result = Catch::Session().run (argc, argv);
15+
16+
return result;
17+
}

tests/Catch2Main.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// All test files are included in the executable via the Glob in CMakeLists.txt
2+
3+
#include "juce_gui_basics/juce_gui_basics.h"
4+
#include <catch2/catch_session.hpp>
5+
6+
int main (int argc, char* argv[])
7+
{
8+
// This lets us use JUCE's MessageManager without leaking.
9+
// PluginProcessor might need this if you use the APVTS for example.
10+
// You'll also need it for tests that rely on juce::Graphics, juce::Timer, etc.
11+
// It's nicer DX when placed here vs. manually in Catch2 SECTIONs
12+
juce::ScopedJuceInitialiser_GUI gui;
13+
14+
const int result = Catch::Session().run (argc, argv);
15+
16+
return result;
17+
}
18+
#include <catch2/catch_test_macros.hpp>

0 commit comments

Comments
 (0)