mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
dm: test: add test case for dev_read_u64 function
Add test case to cover dev_read_u64 and dev_read_u64_default functions. Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Simon Glass
parent
ced1080489
commit
70573c6c46
@@ -867,6 +867,7 @@ static int dm_test_read_int(struct unit_test_state *uts)
|
||||
u32 val32;
|
||||
s32 sval;
|
||||
uint val;
|
||||
u64 val64;
|
||||
|
||||
ut_assertok(uclass_first_device_err(UCLASS_TEST_FDT, &dev));
|
||||
ut_asserteq_str("a-test", dev->name);
|
||||
@@ -891,6 +892,15 @@ static int dm_test_read_int(struct unit_test_state *uts)
|
||||
ut_assertok(dev_read_u32u(dev, "uint-value", &val));
|
||||
ut_asserteq(-1234, val);
|
||||
|
||||
ut_assertok(dev_read_u64(dev, "int64-value", &val64));
|
||||
ut_asserteq_64(0x1111222233334444, val64);
|
||||
|
||||
ut_asserteq_64(-EINVAL, dev_read_u64(dev, "missing", &val64));
|
||||
ut_asserteq_64(6, dev_read_u64_default(dev, "missing", 6));
|
||||
|
||||
ut_asserteq_64(0x1111222233334444,
|
||||
dev_read_u64_default(dev, "int64-value", 6));
|
||||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_read_int, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
|
Reference in New Issue
Block a user