From ce09effe1554a4e9bff72d386e8a1ea0e2381a50 Mon Sep 17 00:00:00 2001 From: revsic Date: Fri, 15 Feb 2019 02:26:54 +0900 Subject: [PATCH] obfs, string: Modify to make_string --- test/impl/string_obfs.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/impl/string_obfs.cpp b/test/impl/string_obfs.cpp index c160b80..d88ec2d 100644 --- a/test/impl/string_obfs.cpp +++ b/test/impl/string_obfs.cpp @@ -1,16 +1,14 @@ #include #include -TEST_CASE("xor string obfs", "[StringObfs]") { - using byte = unsigned char; - - auto xor = [](byte key) constexpr { - return [=](char c) constexpr -> char { - return c ^ key; +TEST_CASE("xor test", "[obfs::String]") { + auto xor = [](char key) constexpr { + return [=](char chr) constexpr { + return static_cast(key ^ chr); }; }; REQUIRE( - make_stringobfs("Hello World !", xor(0x20), xor(0x20)).decode() + obfs::make_string("Hello World !", xor(0x20), xor(0x20)).decode() == std::string_view("Hello World !")); } \ No newline at end of file