commit 124853882066d7f89a3ce6bc475643c173a76143 parent 63335a97c46cb12cf700632ba78133535bd85296 Author: cfillion <cfillion@users.noreply.github.com> Date: Mon, 4 Jan 2016 12:15:35 -0500 write tests for the char representation conversion code Diffstat:
A | test/encoding.cpp | | | 27 | +++++++++++++++++++++++++++ |
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/test/encoding.cpp b/test/encoding.cpp @@ -0,0 +1,27 @@ +#include <catch.hpp> + +#include <encoding.hpp> + +using namespace std; + +static const char *M = "[encoding]"; + +TEST_CASE("to_autostring", M) { + REQUIRE(to_autostring(42) == AUTO_STR("42")); +} + +TEST_CASE("string to wstring to string", M) { + SECTION("ascii") { + const auto_string &wstr = make_autostring("hello world"); + const string &str = from_autostring(wstr); + + REQUIRE(str == "hello world"); + } + + SECTION("cyrillic") { + const auto_string &wstr = make_autostring("Новая папка"); + const string &str = from_autostring(wstr); + + REQUIRE(str == "Новая папка"); + } +}