Skip to content

Commit

Permalink
Add Kosovo (#293) (#320)
Browse files Browse the repository at this point in the history
Signed-off-by: Sébastien LAIGRE <[email protected]>
  • Loading branch information
sebalaig authored May 8, 2021
1 parent e1f8fb1 commit 99d4c39
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum class EntsoeGeographicalCode : unsigned int {
HR,
HU,
IT,
KS,
LU,
LT,
MA,
Expand Down
1 change: 1 addition & 0 deletions extensions/entsoe/src/EntsoeGeographicalCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const std::initializer_list<std::string>& getNames<powsybl::iidm::extensions::en
"HR",
"HU",
"IT",
"KS",
"LU",
"LT",
"MA",
Expand Down
1 change: 1 addition & 0 deletions include/powsybl/iidm/Country.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ enum class Country : unsigned int {
KI,
KP,
KR,
XK,
KW,
KG,
LA,
Expand Down
4 changes: 3 additions & 1 deletion src/iidm/Country.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace powsybl {
namespace iidm {

std::string getCountryName(const Country& country) {
static std::array<std::string, 249> s_countryNames {{
static std::array<std::string, 250> s_countryNames {{
u8"AFGHANISTAN",
u8"ÅLAND ISLANDS",
u8"ALBANIA",
Expand Down Expand Up @@ -138,6 +138,7 @@ std::string getCountryName(const Country& country) {
u8"KIRIBATI",
u8"KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF",
u8"KOREA, REPUBLIC OF",
u8"KOSOVO",
u8"KUWAIT",
u8"KYRGYZSTAN",
u8"LAO PEOPLE'S DEMOCRATIC REPUBLIC",
Expand Down Expand Up @@ -401,6 +402,7 @@ const std::initializer_list<std::string>& getNames<Country>() {
u8"KI",
u8"KP",
u8"KR",
u8"XK",
u8"KW",
u8"KG",
u8"LA",
Expand Down
3 changes: 3 additions & 0 deletions test/iidm/CountryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@ BOOST_AUTO_TEST_SUITE(CountryTestSuite)
BOOST_AUTO_TEST_CASE(getCountryCodeTest) {
BOOST_CHECK_EQUAL(u8"FR", Enum::toString(Country::FR));
BOOST_CHECK_EQUAL(u8"BE", Enum::toString(Country::BE));
BOOST_CHECK_EQUAL(u8"XK", Enum::toString(Country::XK));
}

BOOST_AUTO_TEST_CASE(getCountryFromCodeTest) {
POWSYBL_ASSERT_ENUM_EQ(Country::FR, Enum::fromString<Country>(u8"FR"));
POWSYBL_ASSERT_ENUM_EQ(Country::BE, Enum::fromString<Country>(u8"BE"));
POWSYBL_ASSERT_ENUM_EQ(Country::XK, Enum::fromString<Country>(u8"XK"));

POWSYBL_ASSERT_THROW(Enum::fromString<Country>(u8"INVALID"), AssertionError, "Unexpected Country name: INVALID");
}

BOOST_AUTO_TEST_CASE(getCountryNameTest) {
BOOST_CHECK_EQUAL(u8"FRANCE", getCountryName(Country::FR));
BOOST_CHECK_EQUAL(u8"BELGIUM", getCountryName(Country::BE));
BOOST_CHECK_EQUAL(u8"KOSOVO", getCountryName(Country::XK));
}

BOOST_AUTO_TEST_SUITE_END()
Expand Down

0 comments on commit 99d4c39

Please sign in to comment.