"Fossies" - the Fresh Open Source Software Archive

Member "pdns-auth-4.2.0/pdns/test-digests_hh.cc" (27 Aug 2019, 822 Bytes) of package /linux/misc/dns/pdns-auth-4.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "test-digests_hh.cc" see the Fossies "Dox" file reference documentation.

    1 #define BOOST_TEST_DYN_LINK
    2 #define BOOST_TEST_NO_MAIN
    3 #ifdef HAVE_CONFIG_H
    4 #include "config.h"
    5 #endif
    6 #include <boost/test/unit_test.hpp>
    7 #include <boost/assign/list_of.hpp>
    8 
    9 #include "digests.hh"
   10 #include "misc.hh"
   11 
   12 using namespace boost;
   13 
   14 BOOST_AUTO_TEST_SUITE(test_digests_hh)
   15 
   16 BOOST_AUTO_TEST_CASE(test_pdns_md5sum)
   17 {
   18    std::string result = "a3 24 8c e3 1a 88 a6 40 e6 30 73 98 57 6d 06 9e ";
   19    std::string sum = pdns_md5sum("a quick brown fox jumped over the lazy dog");
   20 
   21    BOOST_CHECK_EQUAL(makeHexDump(sum), result);
   22 }
   23 
   24 BOOST_AUTO_TEST_CASE(test_pdns_sha1sum)
   25 {
   26    std::string result = "b9 37 10 0d c9 57 b3 86 d9 cb 77 fc 90 c0 18 22 fd eb 6e 7f ";
   27    std::string sum = pdns_sha1sum("a quick brown fox jumped over the lazy dog");
   28 
   29    BOOST_CHECK_EQUAL(makeHexDump(sum), result);
   30 }
   31 
   32 BOOST_AUTO_TEST_SUITE_END()