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>
This commit is contained in:
Jakub Czapiga
2022-01-10 13:36:47 +00:00
committed by Felix Held
parent 63ec2ac97a
commit c08b6a7037
31 changed files with 1225 additions and 1228 deletions

View File

@ -14,30 +14,30 @@ static void test_region(void **state)
assert_true(VAL(5) + VAL(10) > VAL(10));
assert_true(VAL(7) + VAL(10) < VAL(10));
struct region outer = { .offset = VAL(2), .size = VAL(4) };
struct region outer = {.offset = VAL(2), .size = VAL(4)};
assert_int_equal(region_offset(&outer), VAL(2));
assert_int_equal(region_sz(&outer), VAL(4));
assert_int_equal(region_end(&outer), VAL(6));
struct region inner = { .offset = VAL(3), .size = VAL(2) };
struct region inner = {.offset = VAL(3), .size = VAL(2)};
assert_true(region_is_subregion(&outer, &inner));
struct region touching_bottom = { .offset = VAL(2), .size = VAL(1) };
struct region touching_bottom = {.offset = VAL(2), .size = VAL(1)};
assert_true(region_is_subregion(&outer, &touching_bottom));
struct region touching_top = { .offset = VAL(5), .size = VAL(1) };
struct region touching_top = {.offset = VAL(5), .size = VAL(1)};
assert_true(region_is_subregion(&outer, &touching_top));
struct region overlap_bottom = { .offset = VAL(1), .size = VAL(2) };
struct region overlap_bottom = {.offset = VAL(1), .size = VAL(2)};
assert_false(region_is_subregion(&outer, &overlap_bottom));
struct region overlap_top = { .offset = VAL(5), .size = VAL(2) };
struct region overlap_top = {.offset = VAL(5), .size = VAL(2)};
assert_false(region_is_subregion(&outer, &overlap_top));
struct region below = { .offset = 0, .size = VAL(1) };
struct region below = {.offset = 0, .size = VAL(1)};
assert_false(region_is_subregion(&outer, &below));
struct region above = { .offset = VAL(0xf), .size = VAL(1) };
struct region above = {.offset = VAL(0xf), .size = VAL(1)};
assert_false(region_is_subregion(&outer, &above));
}
@ -58,8 +58,8 @@ static int mock_unmap(const struct region_device *rdev, void *mapping)
return mock();
}
static ssize_t mock_readat(const struct region_device *rdev, void *buffer,
size_t offset, size_t size)
static ssize_t mock_readat(const struct region_device *rdev, void *buffer, size_t offset,
size_t size)
{
check_expected_ptr(rdev);
check_expected_ptr(buffer);
@ -73,8 +73,8 @@ static ssize_t mock_readat(const struct region_device *rdev, void *buffer,
return ret;
}
static ssize_t mock_writeat(const struct region_device *rdev, const void *buffer,
size_t offset, size_t size)
static ssize_t mock_writeat(const struct region_device *rdev, const void *buffer, size_t offset,
size_t size)
{
check_expected_ptr(rdev);
check_expected_ptr(buffer);
@ -365,7 +365,7 @@ static void test_mem_rdev(void **state)
/* Test read/write/erase of larger chunk. */
size_t offs = 0x47;
size_t chunk = 0x72;
size_t chunk = 0x72;
memset(backing, 0, size);
memset(scratch, 0, size);
memset(scratch + offs, 0x39, chunk);