Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <gtest/gtest.h>
00020
00021 #include <variant_topic_tools/MD5Sum.h>
00022
00023 using namespace variant_topic_tools;
00024
00025 TEST(MD5Sum, StringHashing) {
00026 MD5Sum h1;
00027 MD5Sum h2("0123456789abcdef");
00028 MD5Sum h3("Franz jagt im komplett verwahrlosten Taxi quer durch Bayern");
00029 MD5Sum h4("Frank jagt im komplett verwahrlosten Taxi quer durch Bayern");
00030 MD5Sum h5;
00031 h5 << "Franz" << " jagt" << " im" << " komplett"<< " verwahrlosten" <<
00032 " Taxi" << " quer" << " durch" << " Bayern";
00033
00034 EXPECT_EQ(0, h1.getNumDigestedBits());
00035 EXPECT_EQ("d41d8cd98f00b204e9800998ecf8427e", h1.toString());
00036 EXPECT_EQ(16*8, h2.getNumDigestedBits());
00037 EXPECT_EQ("4032af8d61035123906e58e067140cc5", h2.toString());
00038 EXPECT_EQ(59*8, h3.getNumDigestedBits());
00039 EXPECT_EQ("a3cca2b2aa1e3b5b3b5aad99a8529074", h3.toString());
00040 EXPECT_EQ(59*8, h4.getNumDigestedBits());
00041 EXPECT_EQ("7e716d0e702df0505fc72e2b89467910", h4.toString());
00042 EXPECT_EQ(59*8, h5.getNumDigestedBits());
00043 EXPECT_EQ("a3cca2b2aa1e3b5b3b5aad99a8529074", h5.toString());
00044 }