coreboot-kgpe-d16/tests/device/ddr4-test.c
Jakub Czapiga c08b6a7037 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>
2022-01-14 14:29:29 +00:00

39 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/dram/ddr4.h>
#include <tests/test.h>
static void ddr4_speed_mhz_to_mts_test(void **state)
{
assert_int_equal(0, ddr4_speed_mhz_to_reported_mts(0));
assert_int_equal(0, ddr4_speed_mhz_to_reported_mts(667));
assert_int_equal(1600, ddr4_speed_mhz_to_reported_mts(668));
assert_int_equal(1600, ddr4_speed_mhz_to_reported_mts(800));
assert_int_equal(1866, ddr4_speed_mhz_to_reported_mts(801));
assert_int_equal(1866, ddr4_speed_mhz_to_reported_mts(933));
assert_int_equal(1866, ddr4_speed_mhz_to_reported_mts(934));
assert_int_equal(2133, ddr4_speed_mhz_to_reported_mts(1066));
assert_int_equal(2133, ddr4_speed_mhz_to_reported_mts(1067));
assert_int_equal(2400, ddr4_speed_mhz_to_reported_mts(1200));
assert_int_equal(2666, ddr4_speed_mhz_to_reported_mts(1333));
assert_int_equal(2933, ddr4_speed_mhz_to_reported_mts(1466));
assert_int_equal(3200, ddr4_speed_mhz_to_reported_mts(1467));
assert_int_equal(3200, ddr4_speed_mhz_to_reported_mts(1600));
assert_int_equal(0, ddr4_speed_mhz_to_reported_mts(1601));
assert_int_equal(0, ddr4_speed_mhz_to_reported_mts(INT16_MAX));
}
int main(void)
{
const struct CMUnitTest tests[] = {cmocka_unit_test(ddr4_speed_mhz_to_mts_test)};
return cb_run_group_tests(tests, NULL, NULL);
}