aboutsummaryrefslogtreecommitdiff
path: root/core/tests/disposition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests/disposition.cpp')
-rw-r--r--core/tests/disposition.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/tests/disposition.cpp b/core/tests/disposition.cpp
new file mode 100644
index 0000000..3a35741
--- /dev/null
+++ b/core/tests/disposition.cpp
@@ -0,0 +1,32 @@
+#include "turns/core/disposition.hpp"
+
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/generators/catch_generators.hpp>
+
+#include <compare>
+#include <format>
+#include <limits>
+#include <utility>
+
+#include <glibmm/i18n.h>
+#include <glibmm/ustring.h>
+
+namespace turns::core::tests
+{
+
+ TEST_CASE("to_presentation_name returns the correct string for the current language", "[disposition]")
+ {
+ auto [value, name] = GENERATE(std::pair{disposition::neutral, Glib::ustring{_("Neutral")}},
+ std::pair{disposition::friendly, Glib::ustring{_("Friendly")}},
+ std::pair{disposition::hostile, Glib::ustring{_("Hostile")}},
+ std::pair{disposition::secret, Glib::ustring{_("Secret")}},
+ std::pair{static_cast<disposition>(std::numeric_limits<std::underlying_type_t<disposition>>::max()),
+ Glib::ustring{_("Unknown disposition value")}});
+
+ SECTION(std::format("the presentation name for '{}' is '{}'", static_cast<std::underlying_type_t<disposition>>(value), name.c_str()))
+ {
+ REQUIRE(presentation_name_for(value) == name);
+ }
+ }
+
+} // namespace turns::core::tests \ No newline at end of file