| Tests SegmentedRange |
| |
| Test case: one |
| Input Segments: [[0,1,"a"]] |
| Result: |
| 0 - 1: a |
| Test case: two adjacent |
| Input Segments: [[0,1,"a"],[1,2,"a"]] |
| Result: |
| 0 - 2: a |
| Test case: two apart |
| Input Segments: [[0,1,"a"],[2,3,"a"]] |
| Result: |
| 0 - 1: a |
| 2 - 3: a |
| Test case: two overlapping |
| Input Segments: [[0,2,"a"],[2,3,"a"]] |
| Result: |
| 0 - 3: a |
| Test case: two overlapping no merge |
| Input Segments: [[0,2,"a"],[2,3,"b"]] |
| Result: |
| 0 - 2: a |
| 2 - 3: b |
| Test case: one inside another |
| Input Segments: [[0,3,"a"],[1,2,"a"]] |
| Result: |
| 0 - 3: a |
| Test case: one inside another, no merge |
| Input Segments: [[0,3,"a"],[1,2,"b"]] |
| Result: |
| 0 - 1: a |
| 1 - 2: b |
| 2 - 3: a |
| Result backwards: |
| 0 - 3: a |
| Test case: one between two others |
| Input Segments: [[0,2,"a"],[3,5,"a"],[2,3,"a"]] |
| Result: |
| 0 - 5: a |
| Test case: one between two others, no merge |
| Input Segments: [[0,2,"a"],[3,5,"b"],[2,3,"a"]] |
| Result: |
| 0 - 2: a |
| 2 - 3: a |
| 3 - 5: b |
| Test case: one overlapping two others |
| Input Segments: [[0,2,"a"],[3,5,"a"],[1,4,"a"]] |
| Result: |
| 0 - 5: a |
| Test case: one overlapping two others, no merge |
| Input Segments: [[0,2,"a"],[3,5,"b"],[1,4,"a"]] |
| Result: |
| 0 - 1: a |
| 1 - 4: a |
| 4 - 5: b |
| Result backwards: |
| 0 - 2: a |
| 2 - 3: a |
| 3 - 5: b |
| Test case: one consuming many: |
| Input Segments: [[0,1,"a"],[2,3,"a"],[4,5,"a"],[6,7,"a"],[2,6,"a"]] |
| Result: |
| 0 - 1: a |
| 2 - 7: a |
| Test case: one consuming many, no merge: |
| Input Segments: [[0,1,"a"],[2,3,"a"],[4,5,"a"],[6,7,"a"],[2,6,"a"]] |
| Result: |
| 0 - 1: a |
| 2 - 6: a |
| 6 - 7: a |
| Result backwards: |
| 0 - 1: a |
| 2 - 3: a |
| 3 - 4: a |
| 4 - 5: a |
| 5 - 6: a |
| 6 - 7: a |
| |