| 80 | } |
| 81 | |
| 82 | void test_patternmatchingwithouttrailingzeros() |
| 83 | { |
| 84 | FluxPattern fp(16, 0x000b); |
| 85 | const unsigned matching[] = {100, 100, 200, 100}; |
| 86 | const unsigned notmatching[] = {100, 200, 100, 100}; |
| 87 | const unsigned closematch1[] = {90, 90, 180, 90}; |
| 88 | const unsigned closematch2[] = {110, 110, 220, 110}; |
| 89 | |
| 90 | FluxMatch match; |
| 91 | assert(fp.matches(&matching[4], match), true); |
| 92 | assert(match.intervals, 2U); |
| 93 | |
| 94 | assert(fp.matches(¬matching[4], match), false); |
| 95 | |
| 96 | assert(fp.matches(&closematch1[4], match), true); |
| 97 | assert(match.intervals, 2U); |
| 98 | |
| 99 | assert(fp.matches(&closematch2[4], match), true); |
| 100 | assert(match.intervals, 2U); |
| 101 | } |
| 102 | |
| 103 | void test_patternmatchingwithtrailingzeros() |
| 104 | { |