@@ -44,29 +44,29 @@ bool test_fhss_enable()
44
44
fhss_timer .fhss_timer_stop = & fhss_timer_stop_stub ;
45
45
46
46
// Test NULL configurations
47
- if (fhss_enable (NULL , & fhss_configuration , & fhss_timer , NULL ) != -1 ) {
47
+ if (fhss_enable (NULL , & fhss_configuration , & fhss_timer , NULL ) != NULL ) {
48
48
return false;
49
49
}
50
- if (fhss_enable (fhss_api , NULL , & fhss_timer , NULL ) != -1 ) {
50
+ if (fhss_enable (fhss_api , NULL , & fhss_timer , NULL ) != NULL ) {
51
51
return false;
52
52
}
53
- if (fhss_enable (fhss_api , & fhss_configuration , NULL , NULL ) != -1 ) {
53
+ if (fhss_enable (fhss_api , & fhss_configuration , NULL , NULL ) != NULL ) {
54
54
return false;
55
55
}
56
56
// Test without channels
57
57
channel_list_stub .uint8_value = 0 ;
58
- if (fhss_enable (fhss_api , & fhss_configuration , & fhss_timer , NULL ) != -2 ) {
58
+ if (fhss_enable (fhss_api , & fhss_configuration , & fhss_timer , NULL ) != NULL ) {
59
59
return false;
60
60
}
61
61
// Test without memory
62
62
nsdynmemlib_stub .returnCounter = 0 ;
63
63
channel_list_stub .uint8_value = 50 ;
64
- if (fhss_enable (fhss_api , & fhss_configuration , & fhss_timer , NULL ) != -3 ) {
64
+ if (fhss_enable (fhss_api , & fhss_configuration , & fhss_timer , NULL ) != NULL ) {
65
65
return false;
66
66
}
67
67
// Test with proper configuration
68
68
nsdynmemlib_stub .returnCounter = 1 ;
69
- if (fhss_enable (fhss_api , & fhss_configuration , & fhss_timer , NULL ) != 0 ) {
69
+ if (fhss_enable (fhss_api , & fhss_configuration , & fhss_timer , NULL ) == NULL ) {
70
70
return false;
71
71
}
72
72
// Test that API is stored
@@ -86,7 +86,7 @@ bool test_fhss_enable()
86
86
// Test tasklet creation failed
87
87
fhss_beacon_tasklet_stub .int8_value = -1 ;
88
88
nsdynmemlib_stub .returnCounter = 1 ;
89
- if (fhss_enable (fhss_api , & fhss_configuration , & fhss_timer , NULL ) != -5 ) {
89
+ if (fhss_enable (fhss_api , & fhss_configuration , & fhss_timer , NULL ) != NULL ) {
90
90
return false;
91
91
}
92
92
fhss_disable (fhss_struct );
@@ -551,6 +551,7 @@ bool test_fhss_set_datarate()
551
551
bool test_fhss_sync_with_beacon ()
552
552
{
553
553
fhss_struct = malloc (sizeof (fhss_structure_t ));
554
+ memset (fhss_struct , 0 , sizeof (fhss_structure_t ));
554
555
fhss_synchronization_beacon_payload_s payload ;
555
556
556
557
fhss_struct -> number_of_channels = 50 ;
@@ -564,6 +565,7 @@ bool test_fhss_sync_with_beacon()
564
565
fhss_struct -> platform_functions .fhss_timer_stop = & fhss_timer_stop_stub ;
565
566
fhss_struct -> platform_functions .fhss_timer_start = & fhss_timer_start ;
566
567
fhss_struct -> platform_functions .fhss_get_remaining_slots = & fhss_get_remaining_slots_stub ;
568
+ fhss_struct -> platform_functions .fhss_resolution_divider = 1 ;
567
569
fhss_struct -> fhss_configuration .fhss_max_synch_interval = 240 ;
568
570
fhss_struct -> synch_interval = 150000 ;
569
571
@@ -747,6 +749,7 @@ bool test_fhss_superframe_handler()
747
749
{
748
750
fhss_api_t fhss_api ;
749
751
fhss_struct = malloc (sizeof (fhss_structure_t ));
752
+ memset (fhss_struct , 0 , sizeof (fhss_structure_t ));
750
753
fhss_struct -> fhss_api = & fhss_api ;
751
754
fhss_struct -> platform_functions .fhss_timer_start = & fhss_timer_start ;
752
755
fhss_struct -> callbacks .read_tx_queue_size = & mac_read_tx_queue_sizes ;
@@ -775,8 +778,7 @@ bool test_fhss_superframe_handler()
775
778
fhss_struct -> channel_list_counter = 999 ;
776
779
fhss_superframe_handler (& fhss_api , 0 );
777
780
// Current superframe, channel index, Beacons sent counter and channel list counter should be cleared
778
- if (fhss_struct -> current_superframe != 0 || fhss_struct -> current_channel_index != 0 ||
779
- fhss_struct -> synch_infos_sent_counter != 0 || fhss_struct -> channel_list_counter != 0 ) {
781
+ if (fhss_struct -> current_superframe != 0 || fhss_struct -> current_channel_index != 0 ) {
780
782
return false;
781
783
}
782
784
fhss_struct -> fhss_timeout = 50000 ;
0 commit comments