diff --git a/tests/path_offset.c b/tests/path_offset.c index 0ff710d..af53daf 100644 --- a/tests/path_offset.c +++ b/tests/path_offset.c @@ -58,6 +58,8 @@ static void check_path_offset(void *fdt, char *path, int offset) { int rc; + verbose_printf("Checking offset of \"%s\" is %d...\n", path, offset); + rc = fdt_path_offset(fdt, path); if (rc < 0) FAIL("fdt_path_offset(\"%s\") failed: %s", @@ -92,5 +94,13 @@ int main(int argc, char *argv[]) check_path_offset(fdt, "/subnode@2/subsubnode@0", subsubnode2_offset); check_path_offset(fdt, "/subnode@2/subsubnode", subsubnode2_offset2); + /* Test paths with extraneous separators */ + check_path_offset(fdt, "//", 0); + check_path_offset(fdt, "///", 0); + check_path_offset(fdt, "//subnode@1", subnode1_offset); + check_path_offset(fdt, "/subnode@1/", subnode1_offset); + check_path_offset(fdt, "//subnode@1///", subnode1_offset); + check_path_offset(fdt, "/subnode@2////subsubnode", subsubnode2_offset2); + PASS(); }