obfs, string: Modify to make_string

This commit is contained in:
revsic
2019-02-15 02:26:54 +09:00
parent 2285a1e560
commit ce09effe15
+5 -7
View File
@@ -1,16 +1,14 @@
#include <string_obfs.hpp>
#include <catch2/catch.hpp>
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<char>(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 !"));
}