You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
669 B

/**
* Copyright (c) 2018 Niklas Rosenstein
* MIT licensed.
*/
#include <gtest/gtest.h>
#include <NiklasRosenstein/md5.hpp>
#include <NiklasRosenstein/string.hpp>
namespace nr = niklasrosenstein;
static char const* testcases[] = {
"5d41402abc4b2a76b9719d911017c592", "hello",
"7ba5f2fbcbdc4ae2c534b3e465d7289d", "Foo!fzxfBar",
"459eb8ae005b152640eef3d83a0b31a6", "http://www.md5.cz/",
"184bbe3aece849b721d2d8cc38434600", "Fancy fancy md5!",
0, 0
};
TEST(md5, test) {
for (int i = 0; testcases[i]; i += 2) {
std::string hash = nr::md5(testcases[i + 1]).hexdigest();
std::string reference = testcases[i];
ASSERT_EQ(hash, reference);
}
}