speedtest_SOURCES=speedtest.cc dnsparser.cc dnsparser.hh dnsrecords.cc dnswriter.cc dnslabeltext.cc dnswriter.hh \
misc.cc misc.hh rcpgenerator.cc rcpgenerator.hh base64.cc base64.hh unix_utility.cc \
- qtype.cc sillyrecords.cc logger.cc statbag.cc nsecrecords.cc base32.cc
+ qtype.cc sillyrecords.cc logger.cc statbag.cc nsecrecords.cc base32.cc
dnswasher_SOURCES=dnswasher.cc misc.cc unix_utility.cc qtype.cc \
logger.cc statbag.cc dnspcap.cc dnspcap.hh dnsparser.hh
unix_utility.cc logger.cc statbag.cc arguments.cc qtype.cc dnspacket.cc \
dnswriter.cc base64.cc base32.cc dnsrecords.cc dnslabeltext.cc dnsparser.cc \
rcpgenerator.cc ednssubnet.cc nsecrecords.cc sillyrecords.cc dnssecinfra.cc \
- md5.cc test-base64_cc.cc test-iputils_hh.cc
+ md5.cc test-base64_cc.cc test-iputils_hh.cc test-dns_random_hh.cc aes/dns_random.cc \
+ aes/aescpp.h \
+ aes/aescrypt.c aes/aes.h aes/aeskey.c aes/aes_modes.c aes/aesopt.h \
+ aes/aestab.c aes/aestab.h aes/brg_endian.h aes/brg_types.h
testrunner_LDFLAGS= @DYNLINKFLAGS@ @THREADFLAGS@ $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS)
testrunner_LDADD= ext/polarssl-1.1.2/library/libpolarssl.a $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
--- /dev/null
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_NO_MAIN
+#include <boost/test/unit_test.hpp>
+#include <boost/assign/std/map.hpp>
+#include <boost/foreach.hpp>
+#include <boost/accumulators/statistics/median.hpp>
+#include <boost/accumulators/statistics/mean.hpp>
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/statistics.hpp>
+
+#include "dns_random.hh"
+#include "namespaces.hh"
+
+using namespace boost;
+using namespace boost::accumulators;
+
+typedef accumulator_set<
+ double
+ , stats<boost::accumulators::tag::median(with_p_square_quantile),
+ boost::accumulators::tag::mean(immediate)
+ >
+ > acc_t;
+
+
+
+BOOST_AUTO_TEST_SUITE(test_dns_random_hh)
+
+BOOST_AUTO_TEST_CASE(test_dns_random_average) {
+ dns_random_init("/dev/urandom");
+ acc_t acc;
+
+
+ for(unsigned int n=0; n < 100000; ++n) {
+ acc(dns_random(100000)/100000.0);
+ }
+ BOOST_CHECK_CLOSE(0.5, median(acc), 2.0); // within 2%
+ BOOST_CHECK_CLOSE(0.5, mean(acc), 2.0);
+
+ // please add covariance tests, chi-square, Kolmogorov-Smirnov
+}
+
+BOOST_AUTO_TEST_SUITE_END()