1
0
mirror of https://github.com/falk-werner/webfused synced 2024-10-27 20:44:08 +00:00
falk-werner_webfused/test/test_config.cc
2020-03-08 16:14:55 +01:00

57 lines
1.4 KiB
C++

#include <gtest/gtest.h>
#include "webfused/config/factory.h"
#include "webfused/config/config.h"
TEST(config, is_loadable)
{
struct wfd_config * config = wfd_config_load_file("webfused.conf");
ASSERT_NE(nullptr, config);
wfd_config_dispose(config);
}
TEST(config, minimal_config)
{
char const minimal[] = "version = { major = 1, minor = 0 }\n";
struct wfd_config * config = wfd_config_load_string(minimal);
ASSERT_NE(nullptr, config);
wfd_config_dispose(config);
}
TEST(config, invalid_major_version_too_low)
{
char const too_low[] = "version = { major = 0, minor = 0 }\n";
struct wfd_config * config = wfd_config_load_string(too_low);
ASSERT_EQ(nullptr, config);
}
TEST(config, invalid_major_version_too_high)
{
char const too_high[] = "version = { major = 2, minor = 0 }\n";
struct wfd_config * config = wfd_config_load_string(too_high);
ASSERT_EQ(nullptr, config);
}
TEST(config, valid_older_minor)
{
char const valid[] = "version = { major = 1, minor = -1 }\n";
struct wfd_config * config = wfd_config_load_string(valid);
ASSERT_NE(nullptr, config);
wfd_config_dispose(config);
}
TEST(config, valid_newer_minor)
{
char const valid[] = "version = { major = 1, minor = 1 }\n";
struct wfd_config * config = wfd_config_load_string(valid);
ASSERT_NE(nullptr, config);
wfd_config_dispose(config);
}