Skip to content

Commit de6ba91

Browse files
author
Cruz Monrreal
authored
Merge pull request #8365 from 0xc0170/fix_astyle_common2
Fix astyle for tests folders
2 parents 395ea06 + 6efa4f2 commit de6ba91

File tree

81 files changed

+1406
-894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1406
-894
lines changed

.astyleignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ features/cryptocell
44
features/mbedtls
55
features/lwipstack/lwip
66
rtos/TARGET_CORTEX/rtx4
7-
features/filesystem/littlefs/littlefs
8-
features/filesystem/fat/ChaN
7+
features/storage/filesystem/littlefs/littlefs/
8+
features/storage/filesystem/fat/ChaN
9+
features/storage/FEATURE_STORAGE
910
features/frameworks
1011
features/FEATURE_BLE/targets
1112
features/unsupported/
12-
features/FEATURE_COMMON_PAL/
1313
hal/storage_abstraction
1414
FEATURE_NANOSTACK/coap-service
1515
FEATURE_NANOSTACK/sal-stack-nanostack
1616
rtos/TARGET_CORTEX/rtx5
17+
TESTS/mbed_hal/trng/pithy
1718
targets
1819
tools

TESTS/mbed_drivers/crc/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void test_thread(void)
130130
char test[] = "123456789";
131131
uint32_t crc;
132132
MbedCRC<POLY_32BIT_ANSI, 32> ct;
133-
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
133+
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char *)test), &crc));
134134
TEST_ASSERT_EQUAL(0xCBF43926, crc);
135135
}
136136

TESTS/mbed_drivers/mem_trace/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <stdarg.h>
2626

2727
#if !MBED_MEM_TRACING_ENABLED
28-
#error [NOT_SUPPORTED] test not supported
28+
#error [NOT_SUPPORTED] test not supported
2929
#endif
3030

3131
using utest::v1::Case;

TESTS/mbed_hal/qspi/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static void _qspi_write_read_test(Qspi &qspi, qspi_bus_width_t write_inst_width,
151151
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
152152
TEST_ASSERT_EQUAL(write_size, buf_len);
153153

154-
if(is_extended_mode(write_inst_width, write_addr_width, write_data_width)) {
154+
if (is_extended_mode(write_inst_width, write_addr_width, write_data_width)) {
155155
// on some flash chips in extended-SPI mode, control commands works only in 1-1-1 mode
156156
// so switching back to 1-1-1 mode
157157
qspi.cmd.configure(MODE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8);
@@ -195,7 +195,7 @@ static void _qspi_write_read_test(Qspi &qspi, qspi_bus_width_t write_inst_width,
195195
}
196196
qspi.cmd.set_dummy_cycles(0);
197197

198-
if(is_extended_mode(read_inst_width, read_addr_width, read_data_width)) {
198+
if (is_extended_mode(read_inst_width, read_addr_width, read_data_width)) {
199199
// on some flash chips in extended-SPI mode, control commands works only in 1-1-1 mode
200200
// so switching back to 1-1-1 mode
201201
qspi.cmd.configure(MODE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8);

TESTS/mbed_hal/qspi/qspi_test_utils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ qspi_status_t erase(uint32_t erase_cmd, uint32_t flash_addr, Qspi &qspi)
201201

202202
qspi_status_t mode_enable(Qspi &qspi, qspi_bus_width_t inst_width, qspi_bus_width_t addr_width, qspi_bus_width_t data_width)
203203
{
204-
if(is_extended_mode(inst_width, addr_width, data_width)) {
204+
if (is_extended_mode(inst_width, addr_width, data_width)) {
205205
return extended_enable(qspi);
206-
} else if(is_dual_mode(inst_width, addr_width, data_width)) {
206+
} else if (is_dual_mode(inst_width, addr_width, data_width)) {
207207
return dual_enable(qspi);
208-
} else if(is_quad_mode(inst_width, addr_width, data_width)) {
208+
} else if (is_quad_mode(inst_width, addr_width, data_width)) {
209209
return quad_enable(qspi);
210210
} else {
211211
return QSPI_STATUS_OK;
@@ -214,11 +214,11 @@ qspi_status_t mode_enable(Qspi &qspi, qspi_bus_width_t inst_width, qspi_bus_widt
214214

215215
qspi_status_t mode_disable(Qspi &qspi, qspi_bus_width_t inst_width, qspi_bus_width_t addr_width, qspi_bus_width_t data_width)
216216
{
217-
if(is_extended_mode(inst_width, addr_width, data_width)) {
217+
if (is_extended_mode(inst_width, addr_width, data_width)) {
218218
return extended_disable(qspi);
219-
} else if(is_dual_mode(inst_width, addr_width, data_width)) {
219+
} else if (is_dual_mode(inst_width, addr_width, data_width)) {
220220
return dual_disable(qspi);
221-
} else if(is_quad_mode(inst_width, addr_width, data_width)) {
221+
} else if (is_quad_mode(inst_width, addr_width, data_width)) {
222222
return quad_disable(qspi);
223223
} else {
224224
return QSPI_STATUS_OK;

TESTS/mbed_hal/sleep/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ void sleep_usticker_test()
8383
const unsigned int wakeup_timestamp = us_ticker_read();
8484

8585
sprintf(info, "Delta ticks: %u, Ticker width: %u, Expected wake up tick: %d, Actual wake up tick: %d, delay ticks: %d, wake up after ticks: %d",
86-
us_to_ticks(sleep_mode_delta_us, ticker_freq), ticker_width, next_match_timestamp, wakeup_timestamp, us_to_ticks(i, ticker_freq) , wakeup_timestamp - start_timestamp);
86+
us_to_ticks(sleep_mode_delta_us, ticker_freq), ticker_width, next_match_timestamp, wakeup_timestamp, us_to_ticks(i, ticker_freq), wakeup_timestamp - start_timestamp);
8787

8888
TEST_ASSERT_MESSAGE(compare_timestamps(us_to_ticks(sleep_mode_delta_us, ticker_freq),
89-
ticker_width, next_match_timestamp, wakeup_timestamp), info);
89+
ticker_width, next_match_timestamp, wakeup_timestamp), info);
9090
}
9191

9292
set_us_ticker_irq_handler(us_ticker_irq_handler_org);
@@ -127,10 +127,10 @@ void deepsleep_lpticker_test()
127127
const timestamp_t wakeup_timestamp = lp_ticker_read();
128128

129129
sprintf(info, "Delta ticks: %u, Ticker width: %u, Expected wake up tick: %d, Actual wake up tick: %d, delay ticks: %d, wake up after ticks: %d",
130-
us_to_ticks(deepsleep_mode_delta_us, ticker_freq), ticker_width, next_match_timestamp, wakeup_timestamp, us_to_ticks(i, ticker_freq) , wakeup_timestamp - start_timestamp);
130+
us_to_ticks(deepsleep_mode_delta_us, ticker_freq), ticker_width, next_match_timestamp, wakeup_timestamp, us_to_ticks(i, ticker_freq), wakeup_timestamp - start_timestamp);
131131

132132
TEST_ASSERT_MESSAGE(compare_timestamps(us_to_ticks(deepsleep_mode_delta_us, ticker_freq), ticker_width,
133-
next_match_timestamp, wakeup_timestamp), info);
133+
next_match_timestamp, wakeup_timestamp), info);
134134
}
135135

136136
set_lp_ticker_irq_handler(lp_ticker_irq_handler_org);
@@ -178,7 +178,7 @@ void deepsleep_high_speed_clocks_turned_off_test()
178178

179179
/* Check if we have woken-up after expected time. */
180180
TEST_ASSERT_MESSAGE(compare_timestamps(us_to_ticks(deepsleep_mode_delta_us, lp_ticker_freq), lp_ticker_width,
181-
wakeup_time, lp_ticks_after_sleep), info);
181+
wakeup_time, lp_ticks_after_sleep), info);
182182
}
183183

184184
#endif

TESTS/mbed_hal/sleep/sleep_test_utils.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646

4747
unsigned int ticks_to_us(unsigned int ticks, unsigned int freq)
4848
{
49-
return (unsigned int) ((unsigned long long) ticks * US_PER_S / freq);
49+
return (unsigned int)((unsigned long long) ticks * US_PER_S / freq);
5050
}
5151

5252
unsigned int us_to_ticks(unsigned int us, unsigned int freq)
5353
{
54-
return (unsigned int) ((unsigned long long) us * freq / US_PER_S);
54+
return (unsigned int)((unsigned long long) us * freq / US_PER_S);
5555
}
5656

5757
unsigned int overflow_protect(unsigned int timestamp, unsigned int ticker_width)
@@ -87,7 +87,7 @@ void busy_wait_ms(int ms)
8787
{
8888
const ticker_info_t *info = us_ticker_get_info();
8989
uint32_t mask = (1 << info->bits) - 1;
90-
int delay = (int) ((uint64_t) ms * info->frequency / 1000);
90+
int delay = (int)((uint64_t) ms * info->frequency / 1000);
9191

9292
uint32_t prev = us_ticker_read();
9393
while (delay > 0) {
@@ -97,13 +97,13 @@ void busy_wait_ms(int ms)
9797
}
9898
}
9999

100-
void us_ticker_isr(const ticker_data_t * const ticker_data)
100+
void us_ticker_isr(const ticker_data_t *const ticker_data)
101101
{
102102
us_ticker_clear_interrupt();
103103
}
104104

105105
#ifdef DEVICE_LPTICKER
106-
void lp_ticker_isr(const ticker_data_t * const ticker_data)
106+
void lp_ticker_isr(const ticker_data_t *const ticker_data)
107107
{
108108
lp_ticker_clear_interrupt();
109109
}

TESTS/mbed_hal/sleep_manager/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void test_lock_gt_ushrt_max()
110110

111111
#if DEVICE_LPTICKER
112112
#if DEVICE_USTICKER
113-
utest::v1::status_t testcase_setup(const Case * const source, const size_t index_of_case)
113+
utest::v1::status_t testcase_setup(const Case *const source, const size_t index_of_case)
114114
{
115115
// Suspend the RTOS kernel scheduler to prevent interference with duration of sleep.
116116
osKernelSuspend();
@@ -130,8 +130,8 @@ utest::v1::status_t testcase_setup(const Case * const source, const size_t index
130130
return utest::v1::greentea_case_setup_handler(source, index_of_case);
131131
}
132132

133-
utest::v1::status_t testcase_teardown(const Case * const source, const size_t passed, const size_t failed,
134-
const utest::v1::failure_t failure)
133+
utest::v1::status_t testcase_teardown(const Case *const source, const size_t passed, const size_t failed,
134+
const utest::v1::failure_t failure)
135135
{
136136
ticker_resume(get_us_ticker_data());
137137
#if DEVICE_LPTICKER

TESTS/mbed_hal/trng/base64b/base64b.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ base64_result_e trng_DecodeNBase64(const char *string,
7272
}
7373

7474
*writePtr = 0;
75-
while (( currPos < stringMaxSize ) &&
76-
( string[currPos] != 0 ) &&
77-
( writePtr < bufferEnd ) &&
78-
( !isEndOfString )) {
75+
while ((currPos < stringMaxSize) &&
76+
(string[currPos] != 0) &&
77+
(writePtr < bufferEnd) &&
78+
(!isEndOfString)) {
7979
uint8_t val;
8080

8181
if (string[currPos] == 0) {
@@ -125,11 +125,11 @@ base64_result_e trng_DecodeNBase64(const char *string,
125125
}
126126

127127
// Check if additional bytes should have been processed but buffer isn't sufficient.
128-
if (( result == BASE64_SUCCESS ) &&
129-
( !isEndOfString ) &&
130-
( currPos < stringMaxSize ) &&
131-
( string[currPos] != 0 ) &&
132-
( string[currPos] != '=' ) ) {
128+
if ((result == BASE64_SUCCESS) &&
129+
(!isEndOfString) &&
130+
(currPos < stringMaxSize) &&
131+
(string[currPos] != 0) &&
132+
(string[currPos] != '=')) {
133133
return BASE64_BUFFER_TOO_SMALL;
134134
}
135135

TESTS/mbed_hal/trng/main.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int fill_buffer_trng(uint8_t *buffer, trng_t *trng_obj, size_t trng_len)
9292

9393
void print_array(uint8_t *buffer, size_t size)
9494
{
95-
for (size_t i=0; i < size; i++) {
95+
for (size_t i = 0; i < size; i++) {
9696
utest_printf("%02x", buffer[i]);
9797
}
9898
utest_printf("\n");
@@ -120,7 +120,7 @@ static void compress_and_compare(char *key, char *value)
120120
uint32_t lengthWritten = 0;
121121
uint32_t charsProcessed = 0;
122122
result = trng_DecodeNBase64((const char *)value,
123-
MSG_VALUE_LEN,
123+
MSG_VALUE_LEN,
124124
buffer,
125125
BUFFER_LEN,
126126
&lengthWritten,
@@ -143,11 +143,11 @@ static void compress_and_compare(char *key, char *value)
143143
(char *)out_comp_buf,
144144
OUT_COMP_BUF_SIZE,
145145
9);
146-
if (comp_sz <= BUFFER_LEN){
147-
print_array(buffer, BUFFER_LEN);
146+
if (comp_sz <= BUFFER_LEN) {
147+
print_array(buffer, BUFFER_LEN);
148148
}
149149
TEST_ASSERT_MESSAGE(comp_sz > BUFFER_LEN,
150-
"TRNG_TEST_STEP1: trng_get_bytes was able to compress thus not random");
150+
"TRNG_TEST_STEP1: trng_get_bytes was able to compress thus not random");
151151

152152
/*pithy_Compress will try to compress the random data with a different buffer size*/
153153
result = fill_buffer_trng(temp_buf, &trng_obj, TEMP_BUF_SIZE);
@@ -158,11 +158,11 @@ static void compress_and_compare(char *key, char *value)
158158
(char *)out_comp_buf,
159159
OUT_COMP_BUF_SIZE,
160160
9);
161-
if (comp_sz <= TEMP_BUF_SIZE){
162-
print_array(temp_buf, TEMP_BUF_SIZE);
161+
if (comp_sz <= TEMP_BUF_SIZE) {
162+
print_array(temp_buf, TEMP_BUF_SIZE);
163163
}
164164
TEST_ASSERT_MESSAGE(comp_sz > TEMP_BUF_SIZE,
165-
"TRNG_TEST_STEP2: trng_get_bytes was able to compress thus not random");
165+
"TRNG_TEST_STEP2: trng_get_bytes was able to compress thus not random");
166166

167167
memcpy(input_buf + BUFFER_LEN, temp_buf, TEMP_BUF_SIZE);
168168
/*pithy_Compress will try to compress the random data from before reset concatenated with new random data*/
@@ -171,11 +171,11 @@ static void compress_and_compare(char *key, char *value)
171171
(char *)out_comp_buf,
172172
OUT_COMP_BUF_SIZE,
173173
9);
174-
if (comp_sz <= TEMP_BUF_SIZE + BUFFER_LEN){
175-
print_array(input_buf, TEMP_BUF_SIZE + BUFFER_LEN);
174+
if (comp_sz <= TEMP_BUF_SIZE + BUFFER_LEN) {
175+
print_array(input_buf, TEMP_BUF_SIZE + BUFFER_LEN);
176176
}
177177
TEST_ASSERT_MESSAGE(comp_sz > TEMP_BUF_SIZE + BUFFER_LEN,
178-
"TRNG_TEST_STEP3: concatenated buffer after reset was able to compress thus not random");
178+
"TRNG_TEST_STEP3: concatenated buffer after reset was able to compress thus not random");
179179

180180
greentea_send_kv(MSG_TRNG_TEST_SUITE_ENDED, MSG_VALUE_DUMMY);
181181
}
@@ -184,9 +184,9 @@ static void compress_and_compare(char *key, char *value)
184184
if (strcmp(key, MSG_TRNG_TEST_STEP1) == 0) {
185185
int result = 0;
186186
/*Using base64 to encode data sending from host*/
187-
result = trng_EncodeBase64(buffer,
188-
BUFFER_LEN,
189-
(char *)out_comp_buf,
187+
result = trng_EncodeBase64(buffer,
188+
BUFFER_LEN,
189+
(char *)out_comp_buf,
190190
OUT_COMP_BUF_SIZE);
191191
TEST_ASSERT_EQUAL(RESULT_SUCCESS, result);
192192

TESTS/mbed_platform/stats_heap/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void test_case_malloc_free_size()
6767
TEST_ASSERT_EQUAL_UINT32(stats_start.alloc_cnt + 1, stats_current.alloc_cnt);
6868
TEST_ASSERT_EQUAL_UINT32(stats_start.alloc_fail_cnt, stats_current.alloc_fail_cnt);
6969
// Library header 0x4-0x8, stats header 0x8 and alignment addition 0x4
70-
TEST_ASSERT_INT_WITHIN(0x8, stats_start.overhead_size + 0xC , stats_current.overhead_size);
70+
TEST_ASSERT_INT_WITHIN(0x8, stats_start.overhead_size + 0xC, stats_current.overhead_size);
7171
// Free memory and assert back to starting size
7272
free(data);
7373
mbed_stats_heap_get(&stats_current);
@@ -97,7 +97,7 @@ void test_case_allocate_zero()
9797
TEST_ASSERT_EQUAL_UINT32(stats_start.alloc_fail_cnt, stats_current.alloc_fail_cnt);
9898
// Library header 0x4-0x8, stats header 0x8 and alignment addition 0x4
9999
if (NULL != data) {
100-
TEST_ASSERT_INT_WITHIN(0x8, stats_start.overhead_size + 0xC , stats_current.overhead_size);
100+
TEST_ASSERT_INT_WITHIN(0x8, stats_start.overhead_size + 0xC, stats_current.overhead_size);
101101
}
102102
// Free memory and assert back to starting size
103103
free(data);

TESTS/mbedmicro-rtos-mbed/mutex/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void test_dual_thread_lock_lock_thread(Mutex *mutex)
199199

200200
bool stat = mutex->trylock_for(TEST_DELAY);
201201
TEST_ASSERT_EQUAL(false, stat);
202-
TEST_ASSERT_UINT32_WITHIN(5000, TEST_DELAY*1000, timer.read_us());
202+
TEST_ASSERT_UINT32_WITHIN(5000, TEST_DELAY * 1000, timer.read_us());
203203
}
204204

205205
/** Test dual thread lock

TESTS/network/interface/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ utest::v1::status_t test_setup(const size_t number_of_cases)
3838
}
3939

4040
Case cases[] = {
41-
Case("NETWORKINTERFACE_STATUS", NETWORKINTERFACE_STATUS),
42-
Case("NETWORKINTERFACE_STATUS_NONBLOCK", NETWORKINTERFACE_STATUS_NONBLOCK),
43-
Case("NETWORKINTERFACE_STATUS_GET", NETWORKINTERFACE_STATUS_GET),
44-
Case("NETWORKINTERFACE_CONN_DISC_REPEAT", NETWORKINTERFACE_CONN_DISC_REPEAT),
41+
Case("NETWORKINTERFACE_STATUS", NETWORKINTERFACE_STATUS),
42+
Case("NETWORKINTERFACE_STATUS_NONBLOCK", NETWORKINTERFACE_STATUS_NONBLOCK),
43+
Case("NETWORKINTERFACE_STATUS_GET", NETWORKINTERFACE_STATUS_GET),
44+
Case("NETWORKINTERFACE_CONN_DISC_REPEAT", NETWORKINTERFACE_CONN_DISC_REPEAT),
4545
};
4646

4747
Specification specification(test_setup, cases);

TESTS/network/interface/networkinterface_conn_disc_repeat.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323

2424
using namespace utest::v1;
2525

26-
namespace
27-
{
28-
NetworkInterface* net;
29-
const int repeats = 5;
26+
namespace {
27+
NetworkInterface *net;
28+
const int repeats = 5;
3029
}
3130

3231
void NETWORKINTERFACE_CONN_DISC_REPEAT()

TESTS/network/interface/networkinterface_status.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@
2323

2424
using namespace utest::v1;
2525

26-
namespace
27-
{
28-
NetworkInterface* net;
29-
rtos::Semaphore status_semaphore;
30-
int status_write_counter = 0;
31-
int status_read_counter = 0;
32-
const int repeats = 5;
33-
const int status_buffer_size = 100;
34-
nsapi_connection_status_t current_status = NSAPI_STATUS_ERROR_UNSUPPORTED;
35-
nsapi_connection_status_t statuses[status_buffer_size];
26+
namespace {
27+
NetworkInterface *net;
28+
rtos::Semaphore status_semaphore;
29+
int status_write_counter = 0;
30+
int status_read_counter = 0;
31+
const int repeats = 5;
32+
const int status_buffer_size = 100;
33+
nsapi_connection_status_t current_status = NSAPI_STATUS_ERROR_UNSUPPORTED;
34+
nsapi_connection_status_t statuses[status_buffer_size];
3635
}
3736

3837
void status_cb(nsapi_event_t event, intptr_t value)

TESTS/network/wifi/wifi_connect_params_channel_fail.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void wifi_connect_params_channel_fail(void)
3434
return;
3535
}
3636

37-
uint8_t wrong_channel = 1 + (MBED_CONF_APP_WIFI_CH_SECURE%10);
37+
uint8_t wrong_channel = 1 + (MBED_CONF_APP_WIFI_CH_SECURE % 10);
3838
nsapi_error_t error = wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security(), wrong_channel);
3939
TEST_ASSERT(error == NSAPI_ERROR_CONNECTION_TIMEOUT || error == NSAPI_ERROR_NO_CONNECTION);
4040

0 commit comments

Comments
 (0)