-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from jhasse/sound-unittest
Add a unittest for playing audio
- Loading branch information
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2024 Jan Niklas Hasse <[email protected]> | ||
// For conditions of distribution and use, see copyright notice in LICENSE.txt | ||
|
||
#include "../jngl/sound.hpp" | ||
|
||
#include <jngl.hpp> | ||
|
||
#include <boost/ut.hpp> | ||
|
||
namespace { | ||
boost::ut::suite _ = [] { | ||
using namespace boost::ut; // NOLINT | ||
"Sound"_test = [] { | ||
jngl::play("../data/test.ogg"); | ||
expect(jngl::isPlaying("../data/test.ogg")); | ||
jngl::stop("../data/test.ogg"); | ||
expect(!jngl::isPlaying("../data/test.ogg")); | ||
}; | ||
}; | ||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
// Copyright 2018-2023 Jan Niklas Hasse <[email protected]> | ||
// Copyright 2018-2024 Jan Niklas Hasse <[email protected]> | ||
// For conditions of distribution and use, see copyright notice in LICENSE.txt | ||
|
||
#include <boost/ut.hpp> | ||
#include <cassert> | ||
|
||
int main() { | ||
int main(int argc, char** argv) { | ||
assert(argc <= 2); | ||
if (argc == 2) { | ||
boost::ut::cfg<boost::ut::override> = { .filter = argv[1] }; | ||
} | ||
return boost::ut::cfg<>.run(); // explicitly run registered test suites | ||
} |