6 void test_fhss_first(void)
8 FHSSrandomiseFHSSsequence(0x01020304L
);
9 TEST_ASSERT_EQUAL(GetInitialFreq(), FHSSfreqs
[sync_channel
]);
12 void test_fhss_assignment(void)
14 FHSSrandomiseFHSSsequence(0x01020304L
);
16 const uint32_t numFhss
= FHSSgetChannelCount();
17 uint32_t initFreq
= GetInitialFreq();
19 uint32_t freq
= initFreq
;
20 for (unsigned int i
= 0; i
< 512; i
++) {
21 if ((i
% numFhss
) == 0) {
22 TEST_ASSERT_EQUAL(initFreq
, freq
);
24 TEST_ASSERT_NOT_EQUAL(initFreq
, freq
);
26 freq
= FHSSgetNextFreq();
30 void test_fhss_unique(void)
32 FHSSrandomiseFHSSsequence(0x01020304L
);
34 const uint32_t numFhss
= FHSSgetChannelCount();
35 std::set
<uint32_t> freqs
;
37 for (unsigned int i
= 0; i
< 256; i
++) {
38 uint32_t freq
= FHSSgetNextFreq();
40 if ((i
% numFhss
) == 0) {
44 bool inserted
= freqs
.insert(freq
).second
;
45 TEST_ASSERT_TRUE_MESSAGE(inserted
, "Should only see a frequency one time per number initial value");
50 void test_fhss_same(void)
52 FHSSrandomiseFHSSsequence(0x01020304L
);
54 const uint32_t numFhss
= FHSSgetSequenceCount();
56 uint32_t fhss
[numFhss
];
58 for (unsigned int i
= 0; i
< FHSSgetSequenceCount(); i
++) {
59 uint32_t freq
= FHSSgetNextFreq();
63 FHSSrandomiseFHSSsequence(0x01020304L
);
65 for (unsigned int i
= 0; i
< FHSSgetSequenceCount(); i
++) {
66 uint32_t freq
= FHSSgetNextFreq();
67 TEST_ASSERT_EQUAL(fhss
[i
],freq
);
71 int main(int argc
, char **argv
)
74 RUN_TEST(test_fhss_first
);
75 RUN_TEST(test_fhss_assignment
);
76 RUN_TEST(test_fhss_unique
);
77 RUN_TEST(test_fhss_same
);