Skip to content

Commit

Permalink
Add Catch2 main functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sudara committed Sep 12, 2024
1 parent c9d9288 commit fb1534d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
17 changes: 17 additions & 0 deletions benchmarks/Catch2Main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// All test files are included in the executable via the Glob in CMakeLists.txt

#include "juce_gui_basics/juce_gui_basics.h"
#include <catch2/catch_session.hpp>

int main (int argc, char* argv[])
{
// This lets us use JUCE's MessageManager without leaking.
// PluginProcessor might need this if you use the APVTS for example.
// You'll also need it for tests that rely on juce::Graphics, juce::Timer, etc.
// It's nicer DX when placed here vs. manually in Catch2 SECTIONs
juce::ScopedJuceInitialiser_GUI gui;

const int result = Catch::Session().run (argc, argv);

return result;
}
18 changes: 18 additions & 0 deletions tests/Catch2Main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// All test files are included in the executable via the Glob in CMakeLists.txt

#include "juce_gui_basics/juce_gui_basics.h"
#include <catch2/catch_session.hpp>

int main (int argc, char* argv[])
{
// This lets us use JUCE's MessageManager without leaking.
// PluginProcessor might need this if you use the APVTS for example.
// You'll also need it for tests that rely on juce::Graphics, juce::Timer, etc.
// It's nicer DX when placed here vs. manually in Catch2 SECTIONs
juce::ScopedJuceInitialiser_GUI gui;

const int result = Catch::Session().run (argc, argv);

return result;
}
#include <catch2/catch_test_macros.hpp>

0 comments on commit fb1534d

Please sign in to comment.