Skip to content

Fix astyle for tests folders #8365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .astyleignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ features/cryptocell
features/mbedtls
features/lwipstack/lwip
rtos/TARGET_CORTEX/rtx4
features/filesystem/littlefs/littlefs
features/filesystem/fat/ChaN
features/storage/filesystem/littlefs/littlefs/
features/storage/filesystem/fat/ChaN
features/storage/FEATURE_STORAGE
features/frameworks
features/FEATURE_BLE/targets
features/unsupported/
features/FEATURE_COMMON_PAL/
hal/storage_abstraction
FEATURE_NANOSTACK/coap-service
FEATURE_NANOSTACK/sal-stack-nanostack
rtos/TARGET_CORTEX/rtx5
TESTS/mbed_hal/trng/pithy
targets
tools
2 changes: 1 addition & 1 deletion TESTS/mbed_drivers/crc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void test_thread(void)
char test[] = "123456789";
uint32_t crc;
MbedCRC<POLY_32BIT_ANSI, 32> ct;
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char *)test), &crc));
TEST_ASSERT_EQUAL(0xCBF43926, crc);
}

Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbed_drivers/mem_trace/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <stdarg.h>

#if !MBED_MEM_TRACING_ENABLED
#error [NOT_SUPPORTED] test not supported
#error [NOT_SUPPORTED] test not supported
#endif

using utest::v1::Case;
Expand Down
4 changes: 2 additions & 2 deletions TESTS/mbed_hal/qspi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static void _qspi_write_read_test(Qspi &qspi, qspi_bus_width_t write_inst_width,
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
TEST_ASSERT_EQUAL(write_size, buf_len);

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

if(is_extended_mode(read_inst_width, read_addr_width, read_data_width)) {
if (is_extended_mode(read_inst_width, read_addr_width, read_data_width)) {
// on some flash chips in extended-SPI mode, control commands works only in 1-1-1 mode
// so switching back to 1-1-1 mode
qspi.cmd.configure(MODE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8);
Expand Down
12 changes: 6 additions & 6 deletions TESTS/mbed_hal/qspi/qspi_test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ qspi_status_t erase(uint32_t erase_cmd, uint32_t flash_addr, Qspi &qspi)

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)
{
if(is_extended_mode(inst_width, addr_width, data_width)) {
if (is_extended_mode(inst_width, addr_width, data_width)) {
return extended_enable(qspi);
} else if(is_dual_mode(inst_width, addr_width, data_width)) {
} else if (is_dual_mode(inst_width, addr_width, data_width)) {
return dual_enable(qspi);
} else if(is_quad_mode(inst_width, addr_width, data_width)) {
} else if (is_quad_mode(inst_width, addr_width, data_width)) {
return quad_enable(qspi);
} else {
return QSPI_STATUS_OK;
Expand All @@ -214,11 +214,11 @@ qspi_status_t mode_enable(Qspi &qspi, qspi_bus_width_t inst_width, qspi_bus_widt

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)
{
if(is_extended_mode(inst_width, addr_width, data_width)) {
if (is_extended_mode(inst_width, addr_width, data_width)) {
return extended_disable(qspi);
} else if(is_dual_mode(inst_width, addr_width, data_width)) {
} else if (is_dual_mode(inst_width, addr_width, data_width)) {
return dual_disable(qspi);
} else if(is_quad_mode(inst_width, addr_width, data_width)) {
} else if (is_quad_mode(inst_width, addr_width, data_width)) {
return quad_disable(qspi);
} else {
return QSPI_STATUS_OK;
Expand Down
10 changes: 5 additions & 5 deletions TESTS/mbed_hal/sleep/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ void sleep_usticker_test()
const unsigned int wakeup_timestamp = us_ticker_read();

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",
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);
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);

TEST_ASSERT_MESSAGE(compare_timestamps(us_to_ticks(sleep_mode_delta_us, ticker_freq),
ticker_width, next_match_timestamp, wakeup_timestamp), info);
ticker_width, next_match_timestamp, wakeup_timestamp), info);
}

set_us_ticker_irq_handler(us_ticker_irq_handler_org);
Expand Down Expand Up @@ -127,10 +127,10 @@ void deepsleep_lpticker_test()
const timestamp_t wakeup_timestamp = lp_ticker_read();

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",
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);
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);

TEST_ASSERT_MESSAGE(compare_timestamps(us_to_ticks(deepsleep_mode_delta_us, ticker_freq), ticker_width,
next_match_timestamp, wakeup_timestamp), info);
next_match_timestamp, wakeup_timestamp), info);
}

set_lp_ticker_irq_handler(lp_ticker_irq_handler_org);
Expand Down Expand Up @@ -178,7 +178,7 @@ void deepsleep_high_speed_clocks_turned_off_test()

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

#endif
Expand Down
10 changes: 5 additions & 5 deletions TESTS/mbed_hal/sleep/sleep_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@

unsigned int ticks_to_us(unsigned int ticks, unsigned int freq)
{
return (unsigned int) ((unsigned long long) ticks * US_PER_S / freq);
return (unsigned int)((unsigned long long) ticks * US_PER_S / freq);
}

unsigned int us_to_ticks(unsigned int us, unsigned int freq)
{
return (unsigned int) ((unsigned long long) us * freq / US_PER_S);
return (unsigned int)((unsigned long long) us * freq / US_PER_S);
}

unsigned int overflow_protect(unsigned int timestamp, unsigned int ticker_width)
Expand Down Expand Up @@ -87,7 +87,7 @@ void busy_wait_ms(int ms)
{
const ticker_info_t *info = us_ticker_get_info();
uint32_t mask = (1 << info->bits) - 1;
int delay = (int) ((uint64_t) ms * info->frequency / 1000);
int delay = (int)((uint64_t) ms * info->frequency / 1000);

uint32_t prev = us_ticker_read();
while (delay > 0) {
Expand All @@ -97,13 +97,13 @@ void busy_wait_ms(int ms)
}
}

void us_ticker_isr(const ticker_data_t * const ticker_data)
void us_ticker_isr(const ticker_data_t *const ticker_data)
{
us_ticker_clear_interrupt();
}

#ifdef DEVICE_LPTICKER
void lp_ticker_isr(const ticker_data_t * const ticker_data)
void lp_ticker_isr(const ticker_data_t *const ticker_data)
{
lp_ticker_clear_interrupt();
}
Expand Down
6 changes: 3 additions & 3 deletions TESTS/mbed_hal/sleep_manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void test_lock_gt_ushrt_max()

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

utest::v1::status_t testcase_teardown(const Case * const source, const size_t passed, const size_t failed,
const utest::v1::failure_t failure)
utest::v1::status_t testcase_teardown(const Case *const source, const size_t passed, const size_t failed,
const utest::v1::failure_t failure)
{
ticker_resume(get_us_ticker_data());
#if DEVICE_LPTICKER
Expand Down
18 changes: 9 additions & 9 deletions TESTS/mbed_hal/trng/base64b/base64b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ base64_result_e trng_DecodeNBase64(const char *string,
}

*writePtr = 0;
while (( currPos < stringMaxSize ) &&
( string[currPos] != 0 ) &&
( writePtr < bufferEnd ) &&
( !isEndOfString )) {
while ((currPos < stringMaxSize) &&
(string[currPos] != 0) &&
(writePtr < bufferEnd) &&
(!isEndOfString)) {
uint8_t val;

if (string[currPos] == 0) {
Expand Down Expand Up @@ -125,11 +125,11 @@ base64_result_e trng_DecodeNBase64(const char *string,
}

// Check if additional bytes should have been processed but buffer isn't sufficient.
if (( result == BASE64_SUCCESS ) &&
( !isEndOfString ) &&
( currPos < stringMaxSize ) &&
( string[currPos] != 0 ) &&
( string[currPos] != '=' ) ) {
if ((result == BASE64_SUCCESS) &&
(!isEndOfString) &&
(currPos < stringMaxSize) &&
(string[currPos] != 0) &&
(string[currPos] != '=')) {
return BASE64_BUFFER_TOO_SMALL;
}

Expand Down
28 changes: 14 additions & 14 deletions TESTS/mbed_hal/trng/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int fill_buffer_trng(uint8_t *buffer, trng_t *trng_obj, size_t trng_len)

void print_array(uint8_t *buffer, size_t size)
{
for (size_t i=0; i < size; i++) {
for (size_t i = 0; i < size; i++) {
utest_printf("%02x", buffer[i]);
}
utest_printf("\n");
Expand Down Expand Up @@ -120,7 +120,7 @@ static void compress_and_compare(char *key, char *value)
uint32_t lengthWritten = 0;
uint32_t charsProcessed = 0;
result = trng_DecodeNBase64((const char *)value,
MSG_VALUE_LEN,
MSG_VALUE_LEN,
buffer,
BUFFER_LEN,
&lengthWritten,
Expand All @@ -143,11 +143,11 @@ static void compress_and_compare(char *key, char *value)
(char *)out_comp_buf,
OUT_COMP_BUF_SIZE,
9);
if (comp_sz <= BUFFER_LEN){
print_array(buffer, BUFFER_LEN);
if (comp_sz <= BUFFER_LEN) {
print_array(buffer, BUFFER_LEN);
}
TEST_ASSERT_MESSAGE(comp_sz > BUFFER_LEN,
"TRNG_TEST_STEP1: trng_get_bytes was able to compress thus not random");
"TRNG_TEST_STEP1: trng_get_bytes was able to compress thus not random");

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

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

greentea_send_kv(MSG_TRNG_TEST_SUITE_ENDED, MSG_VALUE_DUMMY);
}
Expand All @@ -184,9 +184,9 @@ static void compress_and_compare(char *key, char *value)
if (strcmp(key, MSG_TRNG_TEST_STEP1) == 0) {
int result = 0;
/*Using base64 to encode data sending from host*/
result = trng_EncodeBase64(buffer,
BUFFER_LEN,
(char *)out_comp_buf,
result = trng_EncodeBase64(buffer,
BUFFER_LEN,
(char *)out_comp_buf,
OUT_COMP_BUF_SIZE);
TEST_ASSERT_EQUAL(RESULT_SUCCESS, result);

Expand Down
4 changes: 2 additions & 2 deletions TESTS/mbed_platform/stats_heap/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void test_case_malloc_free_size()
TEST_ASSERT_EQUAL_UINT32(stats_start.alloc_cnt + 1, stats_current.alloc_cnt);
TEST_ASSERT_EQUAL_UINT32(stats_start.alloc_fail_cnt, stats_current.alloc_fail_cnt);
// Library header 0x4-0x8, stats header 0x8 and alignment addition 0x4
TEST_ASSERT_INT_WITHIN(0x8, stats_start.overhead_size + 0xC , stats_current.overhead_size);
TEST_ASSERT_INT_WITHIN(0x8, stats_start.overhead_size + 0xC, stats_current.overhead_size);
// Free memory and assert back to starting size
free(data);
mbed_stats_heap_get(&stats_current);
Expand Down Expand Up @@ -97,7 +97,7 @@ void test_case_allocate_zero()
TEST_ASSERT_EQUAL_UINT32(stats_start.alloc_fail_cnt, stats_current.alloc_fail_cnt);
// Library header 0x4-0x8, stats header 0x8 and alignment addition 0x4
if (NULL != data) {
TEST_ASSERT_INT_WITHIN(0x8, stats_start.overhead_size + 0xC , stats_current.overhead_size);
TEST_ASSERT_INT_WITHIN(0x8, stats_start.overhead_size + 0xC, stats_current.overhead_size);
}
// Free memory and assert back to starting size
free(data);
Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbedmicro-rtos-mbed/mutex/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void test_dual_thread_lock_lock_thread(Mutex *mutex)

bool stat = mutex->trylock_for(TEST_DELAY);
TEST_ASSERT_EQUAL(false, stat);
TEST_ASSERT_UINT32_WITHIN(5000, TEST_DELAY*1000, timer.read_us());
TEST_ASSERT_UINT32_WITHIN(5000, TEST_DELAY * 1000, timer.read_us());
}

/** Test dual thread lock
Expand Down
8 changes: 4 additions & 4 deletions TESTS/network/interface/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ utest::v1::status_t test_setup(const size_t number_of_cases)
}

Case cases[] = {
Case("NETWORKINTERFACE_STATUS", NETWORKINTERFACE_STATUS),
Case("NETWORKINTERFACE_STATUS_NONBLOCK", NETWORKINTERFACE_STATUS_NONBLOCK),
Case("NETWORKINTERFACE_STATUS_GET", NETWORKINTERFACE_STATUS_GET),
Case("NETWORKINTERFACE_CONN_DISC_REPEAT", NETWORKINTERFACE_CONN_DISC_REPEAT),
Case("NETWORKINTERFACE_STATUS", NETWORKINTERFACE_STATUS),
Case("NETWORKINTERFACE_STATUS_NONBLOCK", NETWORKINTERFACE_STATUS_NONBLOCK),
Case("NETWORKINTERFACE_STATUS_GET", NETWORKINTERFACE_STATUS_GET),
Case("NETWORKINTERFACE_CONN_DISC_REPEAT", NETWORKINTERFACE_CONN_DISC_REPEAT),
};

Specification specification(test_setup, cases);
Expand Down
7 changes: 3 additions & 4 deletions TESTS/network/interface/networkinterface_conn_disc_repeat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@

using namespace utest::v1;

namespace
{
NetworkInterface* net;
const int repeats = 5;
namespace {
NetworkInterface *net;
const int repeats = 5;
}

void NETWORKINTERFACE_CONN_DISC_REPEAT()
Expand Down
19 changes: 9 additions & 10 deletions TESTS/network/interface/networkinterface_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@

using namespace utest::v1;

namespace
{
NetworkInterface* net;
rtos::Semaphore status_semaphore;
int status_write_counter = 0;
int status_read_counter = 0;
const int repeats = 5;
const int status_buffer_size = 100;
nsapi_connection_status_t current_status = NSAPI_STATUS_ERROR_UNSUPPORTED;
nsapi_connection_status_t statuses[status_buffer_size];
namespace {
NetworkInterface *net;
rtos::Semaphore status_semaphore;
int status_write_counter = 0;
int status_read_counter = 0;
const int repeats = 5;
const int status_buffer_size = 100;
nsapi_connection_status_t current_status = NSAPI_STATUS_ERROR_UNSUPPORTED;
nsapi_connection_status_t statuses[status_buffer_size];
}

void status_cb(nsapi_event_t event, intptr_t value)
Expand Down
2 changes: 1 addition & 1 deletion TESTS/network/wifi/wifi_connect_params_channel_fail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void wifi_connect_params_channel_fail(void)
return;
}

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

Expand Down
Loading