diff --git a/Makefile b/Makefile index 2a3fa0d..8ad096c 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ TOOLS =\ TESTS =\ test-hex\ + hash/test-sha256\ ifeq (${origin CC}, default) CC = g++ diff --git a/test/hash/test-sha256.cpp b/test/hash/test-sha256.cpp new file mode 100644 index 0000000..6c991aa --- /dev/null +++ b/test/hash/test-sha256.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +using namespace hash; + +TEST(hash, sha256) +{ + EXPECT_EQ(hex::encode(sha256(hex::decode("1234"))), "3a103a4e5729ad68c02a678ae39accfbc0ae208096437401b7ceab63cca0622f"); +} +TEST(hash, sha256_1e4) +{ + std::vector data(32); + for(uint64_t i = 0; i < 1e4; i++) + { + sha256(data); + } +} + +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file