Use Catch for our test suite
`make check` is also added to compile and run the tests Catch is fetched with cmake automatically into the build directory when needed
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <config/config.hpp>
|
||||
|
||||
TEST_CASE("Config basic")
|
||||
{
|
||||
Config::filename = "test.cfg";
|
||||
Config::file_must_exist = false;
|
||||
Config::set("coucou", "bonjour", true);
|
||||
Config::close();
|
||||
|
||||
bool error = false;
|
||||
try
|
||||
{
|
||||
Config::file_must_exist = true;
|
||||
CHECK(Config::get("coucou", "") == "bonjour");
|
||||
CHECK(Config::get("does not exist", "default") == "default");
|
||||
Config::close();
|
||||
}
|
||||
catch (const std::ios::failure& e)
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
CHECK_FALSE(error);
|
||||
}
|
||||
Reference in New Issue
Block a user