summaryrefslogtreecommitdiff
path: root/test/dm/ofnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dm/ofnode.c')
-rw-r--r--test/dm/ofnode.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index c72e082983c..5e7c9681c79 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -354,6 +354,7 @@ DM_TEST(dm_test_ofnode_for_each_compatible_node, UT_TESTF_SCAN_FDT);
static int dm_test_ofnode_string(struct unit_test_state *uts)
{
+ const char **val;
const char *out;
ofnode node;
@@ -366,6 +367,10 @@ static int dm_test_ofnode_string(struct unit_test_state *uts)
ut_asserteq_str("test string", out);
ut_asserteq(0, ofnode_stringlist_search(node, "str-value",
"test string"));
+ ut_asserteq(1, ofnode_read_string_list(node, "str-value", &val));
+ ut_asserteq_str("test string", val[0]);
+ ut_assertnull(val[1]);
+ free(val);
/* list of strings */
ut_asserteq(5, ofnode_read_string_count(node, "mux-control-names"));
@@ -374,6 +379,15 @@ static int dm_test_ofnode_string(struct unit_test_state *uts)
ut_asserteq_str("mux0", out);
ut_asserteq(0, ofnode_stringlist_search(node, "mux-control-names",
"mux0"));
+ ut_asserteq(5, ofnode_read_string_list(node, "mux-control-names",
+ &val));
+ ut_asserteq_str("mux0", val[0]);
+ ut_asserteq_str("mux1", val[1]);
+ ut_asserteq_str("mux2", val[2]);
+ ut_asserteq_str("mux3", val[3]);
+ ut_asserteq_str("mux4", val[4]);
+ ut_assertnull(val[5]);
+ free(val);
ut_assertok(ofnode_read_string_index(node, "mux-control-names", 4,
&out));
@@ -387,6 +401,7 @@ DM_TEST(dm_test_ofnode_string, 0);
static int dm_test_ofnode_string_err(struct unit_test_state *uts)
{
+ const char **val;
const char *out;
ofnode node;
@@ -401,16 +416,21 @@ static int dm_test_ofnode_string_err(struct unit_test_state *uts)
ut_asserteq(-EINVAL, ofnode_read_string_count(node, "missing"));
ut_asserteq(-EINVAL, ofnode_read_string_index(node, "missing", 0,
&out));
+ ut_asserteq(-EINVAL, ofnode_read_string_list(node, "missing", &val));
/* empty property */
ut_asserteq(-ENODATA, ofnode_read_string_count(node, "bool-value"));
ut_asserteq(-ENODATA, ofnode_read_string_index(node, "bool-value", 0,
&out));
+ ut_asserteq(-ENODATA, ofnode_read_string_list(node, "bool-value",
+ &val));
/* badly formatted string list */
ut_asserteq(-EILSEQ, ofnode_read_string_count(node, "int64-value"));
ut_asserteq(-EILSEQ, ofnode_read_string_index(node, "int64-value", 0,
&out));
+ ut_asserteq(-EILSEQ, ofnode_read_string_list(node, "int64-value",
+ &val));
/* out of range / not found */
ut_asserteq(-ENODATA, ofnode_read_string_index(node, "str-value", 1,