Logo

index : blog

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/blog.git/html/modules/uniform/tests/010_char_class/find_range.spec.jai blob: 6b56dd24f481c2625cd5375d951cd702c2925f1a [raw] [clear marker]

        
0RANGES :: RuneRange.[
1 .{10, 10},
2 .{12, 15},
3 .{20, 25},
4];
5
6Range_Test_Args :: struct {
7 range: RuneRange;
8 found: bool;
9 index: int;
10}
11
12returns_an_overlapping_range_or_the_insertion_index_params :: Range_Test_Args.[
13 .{.{0, 0}, false, 0},
14 .{.{0, 10}, true, 0},
15 .{.{10, 10}, true, 0},
16 .{.{10, 12}, true, 1},
17 .{.{11, 11}, false, 1},
18 .{.{12, 12}, true, 1},
19 .{.{13, 14}, true, 1},
20 .{.{15, 15}, true, 1},
21 .{.{15, 19}, true, 1},
22 .{.{16, 16}, false, 2},
23 .{.{15, 25}, true, 1},
24 .{.{20, 20}, true, 2},
25 .{.{20, 25}, true, 2},
26 .{.{26, 27}, false, 3},
27];
28
29returns_an_overlapping_range_or_the_insertion_index :: (args: Range_Test_Args) {
30 ranges := RANGES;
31 range, result, found := find_range(ranges, args.range);
32
33 assert_that(found, is(args.found));
34 assert_that(result, is(args.index));
35} @Test
36
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit