summaryrefslogtreecommitdiff
path: root/domain/tests/disposition.cpp
blob: 0d91867df42781b2c34ce1888475bf0c9c5b8150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "turns/domain/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::domain::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::domain::tests