diff options
author | Jakub Czapiga <jacz@semihalf.com> | 2022-01-10 13:36:47 +0000 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-01-14 14:29:29 +0000 |
commit | c08b6a7037e4dd21f08a2fc8d40db51c7b4e051b (patch) | |
tree | bcab84b0853151766b0fe4a3c324e962fb05bb4c /tests/lib/cbmem_console-test.c | |
parent | 63ec2ac97aab17a7e5c8e929c96a188bcd59b9c0 (diff) |
tests: Fix tests code and comments style
This patch applies clang-format settings to most of tests files. Some
files were fixed "by-hand" to exclude some lines, which whould be less
readable after automatic style fixing.
Moreover, some comments (mostly in tests/lib/edid-test.c) were adjusted
to match coreboot coding style guidelines.
Change-Id: I69f25a7b6d8265800c731754e2fbb2255f482134
Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60970
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'tests/lib/cbmem_console-test.c')
-rw-r--r-- | tests/lib/cbmem_console-test.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/tests/lib/cbmem_console-test.c b/tests/lib/cbmem_console-test.c index fca84a7bd4..a5ca3b0933 100644 --- a/tests/lib/cbmem_console-test.c +++ b/tests/lib/cbmem_console-test.c @@ -47,10 +47,11 @@ void test_cbmemc_tx_byte(void **state) { int i; u32 cursor; - const unsigned char data[] = "Random testing string\n" - "`1234567890-=~!@#$%^&*()_+\n" - "abcdefghijklmnopqrstuvwxyz\n" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n"; + const unsigned char data[] = + "Random testing string\n" + "`1234567890-=~!@#$%^&*()_+\n" + "abcdefghijklmnopqrstuvwxyz\n" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n"; for (i = 0; i < ARRAY_SIZE(data); ++i) cbmemc_tx_byte(data[i]); @@ -69,15 +70,16 @@ void test_cbmemc_tx_byte_overflow(void **state) u32 cursor; u32 flags; const uint32_t console_size = current_console->size; - const unsigned char data[] = "Another random string\n" - "abcdefghijklmnopqrstuvwxyz\n" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" - "`1234567890-=~!@#$%^&*()_+\n"; + const unsigned char data[] = + "Another random string\n" + "abcdefghijklmnopqrstuvwxyz\n" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" + "`1234567890-=~!@#$%^&*()_+\n"; const int data_size = ARRAY_SIZE(data) - 1; const int data_stream_length = console_size + data_size; const int overflow_bytes = data_stream_length % console_size; unsigned char *check_buffer = - (unsigned char *)malloc(sizeof(unsigned char) * console_size); + (unsigned char *)malloc(sizeof(unsigned char) * console_size); /* Fill console buffer */ for (i = 0; i < console_size; ++i) @@ -102,16 +104,13 @@ void test_cbmemc_tx_byte_overflow(void **state) assert_int_equal(data_size, cursor); /* Check if overflow buffer was overwritten */ - assert_memory_not_equal(current_console->body, - data, - overflow_bytes); + assert_memory_not_equal(current_console->body, data, overflow_bytes); /* Check if rest of the buffer contents, that should not be overridden, * is the same. */ assert_memory_equal(¤t_console->body[overflow_bytes], - check_buffer + overflow_bytes, - console_size - overflow_bytes); + check_buffer + overflow_bytes, console_size - overflow_bytes); free(check_buffer); } @@ -120,10 +119,10 @@ int main(void) { const struct CMUnitTest tests[] = { cmocka_unit_test_teardown(test_cbmemc_init, teardown_cbmemc), - cmocka_unit_test_setup_teardown(test_cbmemc_tx_byte, - setup_cbmemc, teardown_cbmemc), - cmocka_unit_test_setup_teardown(test_cbmemc_tx_byte_overflow, - setup_cbmemc, teardown_cbmemc), + cmocka_unit_test_setup_teardown(test_cbmemc_tx_byte, setup_cbmemc, + teardown_cbmemc), + cmocka_unit_test_setup_teardown(test_cbmemc_tx_byte_overflow, setup_cbmemc, + teardown_cbmemc), }; return cb_run_group_tests(tests, NULL, NULL); |