File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 556
556
ranges = <0x0 0x0 0x0 0x3eff0000 0x10000>,
557
557
<0x0 0x10000000 0x0 0x10000000 0x2eff0000>;
558
558
};
559
+
560
+ test_ranges_empty: empty@2 {
561
+ reg = <0 2 1>;
562
+ #address-cells = <2>;
563
+ #size-cells = <1>;
564
+
565
+ ranges;
566
+ };
559
567
};
560
568
561
569
device-with-props-0 {
Original file line number Diff line number Diff line change 89
89
90
90
#define TEST_RANGES_PCIE DT_NODELABEL(test_ranges_pcie)
91
91
#define TEST_RANGES_OTHER DT_NODELABEL(test_ranges_other)
92
+ #define TEST_RANGES_EMPTY DT_NODELABEL(test_ranges_empty)
92
93
93
94
#define ZEPHYR_USER DT_PATH(zephyr_user)
94
95
@@ -2269,6 +2270,22 @@ ZTEST(devicetree_api, test_ranges_other)
2269
2270
#undef LENGTH
2270
2271
}
2271
2272
2273
+ ZTEST (devicetree_api , test_ranges_empty )
2274
+ {
2275
+ zassert_equal (DT_NODE_HAS_PROP (TEST_RANGES_EMPTY , ranges ), 1 , "" );
2276
+
2277
+ zassert_equal (DT_NUM_RANGES (TEST_RANGES_EMPTY ), 0 , "" );
2278
+
2279
+ zassert_equal (DT_RANGES_HAS_IDX (TEST_RANGES_EMPTY , 0 ), 0 , "" );
2280
+ zassert_equal (DT_RANGES_HAS_IDX (TEST_RANGES_EMPTY , 1 ), 0 , "" );
2281
+
2282
+ #define FAIL (node_id , idx ) ztest_test_fail();
2283
+
2284
+ DT_FOREACH_RANGE (TEST_RANGES_EMPTY , FAIL );
2285
+
2286
+ #undef FAIL
2287
+ }
2288
+
2272
2289
ZTEST (devicetree_api , test_compat_get_any_status_okay )
2273
2290
{
2274
2291
zassert_true (
You can’t perform that action at this time.
0 commit comments