Skip to content

Commit 3a5ef5e

Browse files
committed
unittests: fix astyle
1 parent 4b3a031 commit 3a5ef5e

38 files changed

+577
-524
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellulardevice/at_cellulardevicetest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ using namespace events;
2626
class TestAT_CellularDevice : public testing::Test {
2727
protected:
2828

29-
void SetUp() {
29+
void SetUp()
30+
{
3031
}
3132

32-
void TearDown() {
33+
void TearDown()
34+
{
3335
}
3436
};
3537

UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
459459
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
460460
EXPECT_TRUE(reg_params._cell_id == 305463233);
461461
EXPECT_TRUE(reg_params._active_time == 240);
462-
EXPECT_TRUE(reg_params._periodic_tau == 70 * 60 *60);
462+
EXPECT_TRUE(reg_params._periodic_tau == 70 * 60 * 60);
463463
ATHandler_stub::read_string_index = kRead_string_table_size;
464464
ATHandler_stub::read_string_value = NULL;
465465
ATHandler_stub::ssize_value = 0;
@@ -469,7 +469,7 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
469469
EXPECT_TRUE(reg_params_check._act == CellularNetwork::RAT_EGPRS);
470470
EXPECT_TRUE(reg_params_check._cell_id == 305463233);
471471
EXPECT_TRUE(reg_params_check._active_time == 240);
472-
EXPECT_TRUE(reg_params_check._periodic_tau == 70 * 60 *60);
472+
EXPECT_TRUE(reg_params_check._periodic_tau == 70 * 60 * 60);
473473

474474
reg_params._status = CellularNetwork::NotRegistered;
475475
reg_params._act = CellularNetwork::RAT_GSM;

UNITTESTS/features/cellular/framework/common/util/utiltest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Testutil : public testing::Test {
3737

3838
TEST_F(Testutil, test_util_binary_str_to_uint)
3939
{
40-
char binary_str[]="011001011101101000";
40+
char binary_str[] = "011001011101101000";
4141
uint32_t value = binary_str_to_uint(binary_str, strlen(binary_str) + 1);
4242
EXPECT_TRUE(value == 104296);
4343
value = binary_str_to_uint(binary_str, strlen(binary_str));
@@ -210,7 +210,7 @@ TEST_F(Testutil, get_dynamic_ip_port)
210210
TEST_F(Testutil, int_to_hex_str)
211211
{
212212
char buf[2];
213-
int_to_hex_str(100, (char*)buf);
213+
int_to_hex_str(100, (char *)buf);
214214

215215
EXPECT_TRUE(buf[0] == '6');
216216
EXPECT_TRUE(buf[1] == '4');

UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@
2525

2626
using namespace events;
2727

28-
class my_phy : public LoRaPHY
29-
{
28+
class my_phy : public LoRaPHY {
3029
public:
31-
my_phy(){};
30+
my_phy() {};
3231

33-
virtual ~my_phy(){};
32+
virtual ~my_phy() {};
3433
};
3534

3635
class Test_LoRaMac : public testing::Test {

UNITTESTS/features/lorawan/loramacchannelplan/Test_LoRaMacChannelPlan.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@
2020
#include "LoRaPHY_stub.h"
2121
#include "LoRaPHY.h"
2222

23-
class my_LoRaPHY : public LoRaPHY
24-
{
23+
class my_LoRaPHY : public LoRaPHY {
2524
public:
26-
my_LoRaPHY(){};
25+
my_LoRaPHY() {};
2726

28-
virtual ~my_LoRaPHY(){};
27+
virtual ~my_LoRaPHY() {};
2928
};
3029

3130

UNITTESTS/features/lorawan/loramaccommand/Test_LoRaMacCommand.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@
2020

2121
#include "LoRaPHY_stub.h"
2222

23-
class my_LoRaPHY : public LoRaPHY
24-
{
23+
class my_LoRaPHY : public LoRaPHY {
2524
public:
26-
my_LoRaPHY(){};
25+
my_LoRaPHY() {};
2726

28-
virtual ~my_LoRaPHY(){};
27+
virtual ~my_LoRaPHY() {};
2928
};
3029

3130
uint8_t my_cb()
@@ -153,7 +152,7 @@ TEST_F(Test_LoRaMacCommand, copy_repeat_commands_to_buffer)
153152

154153
TEST_F(Test_LoRaMacCommand, get_repeat_commands_length)
155154
{
156-
EXPECT_TRUE(object->get_repeat_commands_length() == 0 );
155+
EXPECT_TRUE(object->get_repeat_commands_length() == 0);
157156
}
158157

159158
TEST_F(Test_LoRaMacCommand, clear_sticky_mac_cmd)
@@ -222,7 +221,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
222221
//Overflow add_link_adr_ans function here
223222
object->clear_command_buffer();
224223
buf[0] = 3;
225-
for (int i=0; i < 64; i++) {
224+
for (int i = 0; i < 64; i++) {
226225
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
227226
}
228227
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
@@ -234,7 +233,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
234233

235234
//Overflow add_duty_cycle_ans()
236235
object->clear_command_buffer();
237-
for (int i=0; i < 128; i++) {
236+
for (int i = 0; i < 128; i++) {
238237
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
239238
}
240239
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
@@ -251,7 +250,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
251250
//Overflow add_rx_param_setup_ans
252251
object->clear_command_buffer();
253252
LoRaPHY_stub::uint8_value = 7;
254-
for (int i=0; i < 64; i++) {
253+
for (int i = 0; i < 64; i++) {
255254
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
256255
}
257256
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
@@ -263,7 +262,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
263262

264263
//overflow add_dev_status_ans
265264
object->clear_command_buffer();
266-
for (int i=0; i < 42; i++) {
265+
for (int i = 0; i < 42; i++) {
267266
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
268267
}
269268
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
@@ -280,7 +279,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
280279
//Overflow add_new_channel_ans
281280
object->clear_command_buffer();
282281
LoRaPHY_stub::uint8_value = 7;
283-
for (int i=0; i < 64; i++) {
282+
for (int i = 0; i < 64; i++) {
284283
EXPECT_TRUE(object->process_mac_commands(buf, 0, 6, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
285284
}
286285
EXPECT_TRUE(object->process_mac_commands(buf, 0, 6, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
@@ -293,7 +292,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
293292
//Overflow add_rx_timing_setup_ans
294293
object->clear_command_buffer();
295294
LoRaPHY_stub::uint8_value = 7;
296-
for (int i=0; i < 128; i++) {
295+
for (int i = 0; i < 128; i++) {
297296
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
298297
}
299298
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
@@ -308,7 +307,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
308307
LoRaPHY_stub::bool_table[0] = true;
309308
object->clear_command_buffer();
310309
LoRaPHY_stub::uint8_value = 7;
311-
for (int i=0; i < 128; i++) {
310+
for (int i = 0; i < 128; i++) {
312311
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
313312
LoRaPHY_stub::bool_counter = 0;
314313
}
@@ -326,7 +325,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
326325
LoRaPHY_stub::bool_table[0] = true;
327326
object->clear_command_buffer();
328327
LoRaPHY_stub::uint8_value = 7;
329-
for (int i=0; i < 64; i++) {
328+
for (int i = 0; i < 64; i++) {
330329
EXPECT_TRUE(object->process_mac_commands(buf, 0, 4, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
331330
LoRaPHY_stub::bool_counter = 0;
332331
}

UNITTESTS/features/lorawan/loraphy/Test_LoRaPHY.cpp

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,74 +20,85 @@
2020

2121
#include "LoRaWANTimer_stub.h"
2222

23-
class my_LoRaPHY : public LoRaPHY
24-
{
23+
class my_LoRaPHY : public LoRaPHY {
2524
public:
26-
my_LoRaPHY(){phy_params.adr_ack_delay = 1;}
25+
my_LoRaPHY()
26+
{
27+
phy_params.adr_ack_delay = 1;
28+
}
2729

28-
virtual ~my_LoRaPHY(){}
30+
virtual ~my_LoRaPHY() {}
2931

30-
loraphy_params_t &get_phy_params() {
32+
loraphy_params_t &get_phy_params()
33+
{
3134
return phy_params;
3235
}
3336
};
3437

35-
class my_radio : public LoRaRadio
36-
{
38+
class my_radio : public LoRaRadio {
3739
public:
3840

39-
virtual void init_radio(radio_events_t *events){};
41+
virtual void init_radio(radio_events_t *events) {};
4042

41-
virtual void radio_reset(){};
43+
virtual void radio_reset() {};
4244

43-
virtual void sleep(void){};
45+
virtual void sleep(void) {};
4446

45-
virtual void standby(void){};
47+
virtual void standby(void) {};
4648

47-
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
48-
uint32_t datarate, uint8_t coderate,
49-
uint32_t bandwidth_afc, uint16_t preamble_len,
50-
uint16_t symb_timeout, bool fix_len,
51-
uint8_t payload_len,
52-
bool crc_on, bool freq_hop_on, uint8_t hop_period,
53-
bool iq_inverted, bool rx_continuous){};
49+
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
50+
uint32_t datarate, uint8_t coderate,
51+
uint32_t bandwidth_afc, uint16_t preamble_len,
52+
uint16_t symb_timeout, bool fix_len,
53+
uint8_t payload_len,
54+
bool crc_on, bool freq_hop_on, uint8_t hop_period,
55+
bool iq_inverted, bool rx_continuous) {};
5456

5557
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
56-
uint32_t bandwidth, uint32_t datarate,
57-
uint8_t coderate, uint16_t preamble_len,
58-
bool fix_len, bool crc_on, bool freq_hop_on,
59-
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
58+
uint32_t bandwidth, uint32_t datarate,
59+
uint8_t coderate, uint16_t preamble_len,
60+
bool fix_len, bool crc_on, bool freq_hop_on,
61+
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
6062

61-
virtual void send(uint8_t *buffer, uint8_t size){};
63+
virtual void send(uint8_t *buffer, uint8_t size) {};
6264

63-
virtual void receive(void){};
65+
virtual void receive(void) {};
6466

65-
virtual void set_channel(uint32_t freq){};
67+
virtual void set_channel(uint32_t freq) {};
6668

67-
virtual uint32_t random(void){};
69+
virtual uint32_t random(void) {};
6870

69-
virtual uint8_t get_status(void){return uint8_value;};
71+
virtual uint8_t get_status(void)
72+
{
73+
return uint8_value;
74+
};
7075

71-
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
76+
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
7277

73-
virtual void set_public_network(bool enable){};
78+
virtual void set_public_network(bool enable) {};
7479

75-
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
80+
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
7681

7782
virtual bool perform_carrier_sense(radio_modems_t modem,
78-
uint32_t freq,
79-
int16_t rssi_threshold,
80-
uint32_t max_carrier_sense_time){ return bool_value;};
83+
uint32_t freq,
84+
int16_t rssi_threshold,
85+
uint32_t max_carrier_sense_time)
86+
{
87+
return bool_value;
88+
};
8189

82-
virtual void start_cad(void){};
90+
virtual void start_cad(void) {};
8391

84-
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
92+
virtual bool check_rf_frequency(uint32_t frequency)
93+
{
94+
return bool_value;
95+
};
8596

86-
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
97+
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
8798

88-
virtual void lock(void){};
99+
virtual void lock(void) {};
89100

90-
virtual void unlock(void){};
101+
virtual void unlock(void) {};
91102

92103
bool bool_value;
93104
uint8_t uint8_value;
@@ -410,7 +421,7 @@ TEST_F(Test_LoRaPHY, tx_config)
410421
object->get_phy_params().bands.table = &b;
411422
channel_params_t pp;
412423
memset(&pp, 0, sizeof(channel_params_t));
413-
pp.band=0;
424+
pp.band = 0;
414425
object->get_phy_params().channels.channel_list = &pp;
415426
uint32_t list[1];
416427
list[0] = 125000;
@@ -422,7 +433,7 @@ TEST_F(Test_LoRaPHY, tx_config)
422433
object->set_radio_instance(radio);
423434
tx_config_params_t p;
424435
memset(&p, 0, sizeof(tx_config_params_t));
425-
p.channel=0;
436+
p.channel = 0;
426437
int8_t i = 20;
427438
lorawan_time_t t = 36;
428439
object->tx_config(&p, &i, &t);
@@ -688,7 +699,7 @@ TEST_F(Test_LoRaPHY, add_channel)
688699
TEST_F(Test_LoRaPHY, remove_channel)
689700
{
690701
channel_params_t pp;
691-
pp.band=0;
702+
pp.band = 0;
692703
object->get_phy_params().channels.channel_list = &pp;
693704
uint16_t list[16];
694705
list[0] = 1;
@@ -710,7 +721,7 @@ TEST_F(Test_LoRaPHY, remove_channel)
710721
TEST_F(Test_LoRaPHY, set_tx_cont_mode)
711722
{
712723
channel_params_t pp;
713-
pp.band=0;
724+
pp.band = 0;
714725
object->get_phy_params().channels.channel_list = &pp;
715726
band_t b;
716727
b.max_tx_pwr = 10;
@@ -791,7 +802,7 @@ TEST_F(Test_LoRaPHY, get_default_tx_power)
791802

792803
TEST_F(Test_LoRaPHY, get_max_payload)
793804
{
794-
uint8_t list=8;
805+
uint8_t list = 8;
795806
object->get_phy_params().payloads.table = &list;
796807
object->get_phy_params().payloads_with_repeater.table = &list;
797808
EXPECT_TRUE(8 == object->get_max_payload(0));

0 commit comments

Comments
 (0)