1 #include "GaloisLFSRTest.hpp"
3 #include "math/GaloisLFSR.hpp"
8 CPPUNIT_TEST_SUITE_REGISTRATION(blobs::math::test::GaloisLFSRTest);
17 void GaloisLFSRTest::setUp() {
21 void GaloisLFSRTest::tearDown() {
25 void GaloisLFSRTest::testFloatNorm() {
27 for (int i = 0; i < 64; ++i) {
28 float value = random.SNorm();
30 "random signed normal float",
33 for (int i = 0; i < 64; ++i) {
34 float value = random.UNorm();
36 "random unsigned normal float",
41 void GaloisLFSRTest::testFromContainer() {
43 const vector<int> container({ 1, 2, 3, 4, 5 });
44 for (int i = 0; i < 64; ++i) {
45 int element = random.From(container);
47 "random element from container",
52 void GaloisLFSRTest::AssertBetween(
59 msg << message << ": " << actual << " not in ["
60 << minimum << ',' << maximum << ']';
61 CPPUNIT_ASSERT_MESSAGE(
63 minimum <= actual && actual <= maximum);
67 void GaloisLFSRTest::AssertContains(
69 const vector<int> &container,
73 msg << message << ": " << element << " not in { ";
74 for (int i : container) {
78 CPPUNIT_ASSERT_MESSAGE(
80 find(container.begin(), container.end(), element) != container.end());