diff options
author | Eric Christopher <echristo@gmail.com> | 2013-05-30 00:43:26 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-05-30 00:43:26 +0000 |
commit | 12378d4872c7b522a9f6ea4ac362780bae97ce91 (patch) | |
tree | 1feb5b2c50478e02ad17a0ddc404a11db41a058e /unittests/Support/MD5Test.cpp | |
parent | 8a65e11c9fdfd86d6b9a6b365afcbafddd97a6f3 (diff) | |
download | external_llvm-12378d4872c7b522a9f6ea4ac362780bae97ce91.zip external_llvm-12378d4872c7b522a9f6ea4ac362780bae97ce91.tar.gz external_llvm-12378d4872c7b522a9f6ea4ac362780bae97ce91.tar.bz2 |
Add a comment and some tests including the NULL byte.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182900 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Support/MD5Test.cpp')
-rw-r--r-- | unittests/Support/MD5Test.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/unittests/Support/MD5Test.cpp b/unittests/Support/MD5Test.cpp index 159ae3e..6afaa15 100644 --- a/unittests/Support/MD5Test.cpp +++ b/unittests/Support/MD5Test.cpp @@ -19,6 +19,7 @@ using namespace llvm; namespace { +/// \brief Tests an arbitrary set of bytes passed as \p Input. void TestMD5Sum(ArrayRef<unsigned char> Input, StringRef Final) { MD5 Hash; Hash.update(Input); @@ -38,5 +39,13 @@ TEST(MD5Test, MD5) { (const unsigned char *)"abcdefghijklmnopqrstuvwxyz", (size_t) 26), "c3fcd3d76192e4007dfb496cca67e13b"); + TestMD5Sum(ArrayRef<unsigned char>((const unsigned char *)"\0", (size_t) 1), + "93b885adfe0da089cdf634904fd59f71"); + TestMD5Sum(ArrayRef<unsigned char>((const unsigned char *)"a\0", (size_t) 2), + "4144e195f46de78a3623da7364d04f11"); + TestMD5Sum(ArrayRef<unsigned char>( + (const unsigned char *)"abcdefghijklmnopqrstuvwxyz\0", + (size_t) 27), + "81948d1f1554f58cd1a56ebb01f808cb"); } } |