Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into spirit-x3
- Loading branch information
Showing
5 changed files
with
52 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "catch.hpp" | ||
#include <mapnik/enumeration.hpp> | ||
#include <sstream> | ||
|
||
namespace mapnik { | ||
|
||
enum _test_enumeration_enum : std::uint8_t | ||
{ | ||
TEST_ONE, | ||
TEST_TWO, | ||
_test_enumeration_enum_MAX | ||
}; | ||
|
||
DEFINE_ENUM( _test_enumeration_e, _test_enumeration_enum ); | ||
|
||
static const char * _test_enumeration_strings[] = { | ||
"test_one", | ||
"test_two", | ||
"" | ||
}; | ||
|
||
IMPLEMENT_ENUM( _test_enumeration_e, _test_enumeration_strings ) | ||
|
||
} | ||
|
||
TEST_CASE("enumeration") { | ||
|
||
mapnik::_test_enumeration_e e(mapnik::TEST_ONE); | ||
CHECK( e.as_string() == "test_one" ); | ||
// test the << operator, which calls `as_string` internally | ||
// this is not used in mapnik, but kept for back compat | ||
std::stringstream s; | ||
s << e; | ||
CHECK( s.str() == "test_one" ); | ||
|
||
} |