MCPcopy Create free account
hub / github.com/davisking/dlib / md5_test

Function md5_test

dlib/test/md5.cpp:22–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 logger dlog("test.md5");
21
22 void md5_test (
23 )
24 /*!
25 ensures
26 - runs tests on the md5 stuff compliance with the specs
27 !*/
28 {
29
30 DLIB_TEST(md5 ("") == "d41d8cd98f00b204e9800998ecf8427e");
31 DLIB_TEST(md5 ("a") == "0cc175b9c0f1b6a831c399e269772661");
32 DLIB_TEST(md5 ("abc") == "900150983cd24fb0d6963f7d28e17f72");
33 DLIB_TEST(md5 ("message digest") == "f96b697d7cb7938d525a2f31aaf161d0");
34 DLIB_TEST(md5 ("abcdefghijklmnopqrstuvwxyz") == "c3fcd3d76192e4007dfb496cca67e13b");
35 DLIB_TEST(md5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") == "d174ab98d277d9f5a5611c2c9f419d9f");
36 DLIB_TEST(md5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") == "57edf4a22be3c955ac49da2e2107b67a");
37
38 // make sure the two versions of md5() always agree
39 for (int num = 0; num < 2000; ++num)
40 {
41 std::string temp;
42 for (int i = 0; i < num; ++i)
43 temp += 'a';
44
45 istringstream str(temp);
46 DLIB_TEST(md5(temp) == md5(str));
47 }
48
49 }
50
51
52 class md5_tester : public tester

Callers 1

perform_testMethod · 0.85

Calls 1

md5Function · 0.85

Tested by

no test coverage detected