|
| 1 | + |
1 | 2 | #include <Math/LFSR.h> |
2 | 3 | #include "gtest/gtest.h" |
3 | 4 |
|
4 | 5 | TEST(LFSR, GenerateSequence) |
5 | 6 | { |
6 | | - //PRBS3 |
7 | | - std::array<uint16_t, 2> taps3 = {2, 3}; // Exponents of the monic polynomial |
8 | | - auto prbs3 = ROOT::Math::LFSR::GenerateSequence(std::bitset<3>().flip(), taps3);// Start value all high |
| 7 | + // PRBS3 |
| 8 | + std::array<uint16_t, 2> taps3 = {2, 3}; // Exponents of the monic polynomial |
| 9 | + auto prbs3 = ROOT::Math::LFSR::GenerateSequence(std::bitset<3>().flip(), taps3); // Start value all high |
9 | 10 | EXPECT_EQ(prbs3, std::vector<bool>({false, false, true, false, true, true, true})); |
10 | | - |
11 | | - //PRBS4 |
12 | | - std::array<uint16_t, 2> taps4 = {3, 4}; // Exponents of the monic polynomial |
13 | | - auto prbs4 = ROOT::Math::LFSR::GenerateSequence(std::bitset<4>().flip(), taps4);// Start value all high |
14 | | - EXPECT_EQ(prbs4, std::vector<bool>({false, false, false, true, false, false, true, true, false, true, false, true, true, true, true})); |
15 | | - |
16 | | - //PRBS7 |
17 | | - std::array<uint16_t, 2> taps5 = {5, 3}; // Exponents of the monic polynomial |
18 | | - auto prbs5 = ROOT::Math::LFSR::GenerateSequence(std::bitset<5>().flip(), taps5);// Start value all high |
19 | | - EXPECT_EQ(prbs5, std::vector<bool>({false, false, false, true, true, false, true, true, true, false, true, false, true, false, false, false, false, true, false, false, true, false, true, true, false, false, true, true, true, true, true})); |
| 11 | + |
| 12 | + // PRBS4 |
| 13 | + std::array<uint16_t, 2> taps4 = {3, 4}; // Exponents of the monic polynomial |
| 14 | + auto prbs4 = ROOT::Math::LFSR::GenerateSequence(std::bitset<4>().flip(), taps4); // Start value all high |
| 15 | + EXPECT_EQ(prbs4, std::vector<bool>({false, false, false, true, false, false, true, true, false, true, false, true, |
| 16 | + true, true, true})); |
| 17 | + |
| 18 | + // PRBS7 |
| 19 | + std::array<uint16_t, 2> taps5 = {5, 3}; // Exponents of the monic polynomial |
| 20 | + auto prbs5 = ROOT::Math::LFSR::GenerateSequence(std::bitset<5>().flip(), taps5); // Start value all high |
| 21 | + EXPECT_EQ(prbs5, std::vector<bool>({false, false, false, true, true, false, true, true, true, false, true, |
| 22 | + false, true, false, false, false, false, true, false, false, true, false, |
| 23 | + true, true, false, false, true, true, true, true, true})); |
20 | 24 | } |
0 commit comments