1 #include "GaloisLFSRTest.hpp"
3 #include "rand/GaloisLFSR.hpp"
8 CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::GaloisLFSRTest);
16 void GaloisLFSRTest::setUp() {
20 void GaloisLFSRTest::tearDown() {
24 void GaloisLFSRTest::testFloatNorm() {
26 for (int i = 0; i < 64; ++i) {
27 float value = random.SNorm();
29 "random signed normal float",
32 for (int i = 0; i < 64; ++i) {
33 float value = random.UNorm();
35 "random unsigned normal float",
40 void GaloisLFSRTest::testFromContainer() {
42 const vector<int> container({ 1, 2, 3, 4, 5 });
43 for (int i = 0; i < 64; ++i) {
44 int element = random.From(container);
46 "random element from container",
51 void GaloisLFSRTest::AssertBetween(
58 msg << message << ": " << actual << " not in ["
59 << minimum << ',' << maximum << ']';
60 CPPUNIT_ASSERT_MESSAGE(
62 minimum <= actual && actual <= maximum);
66 void GaloisLFSRTest::AssertContains(
68 const vector<int> &container,
72 msg << message << ": " << element << " not in { ";
73 for (int i : container) {
77 CPPUNIT_ASSERT_MESSAGE(
79 find(container.begin(), container.end(), element) != container.end());