test, string obfs: Add xor string obfuscator tests

This commit is contained in:
revsic
2019-02-14 19:12:57 +09:00
parent a79afecbd3
commit 7c35a53320
+16
View File
@@ -0,0 +1,16 @@
#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;
};
};
REQUIRE(
make_stringobfs("Hello World !", xor(0x20), xor(0x20)).decode()
== std::string_view("Hello World !"));
}