Libraryless. Click here for Pure Java version (14582L/92K).
1 | !7 |
2 | |
3 | set flag OurSubLists. |
4 | set flag NoIllegalAccesses. |
5 | |
6 | module > DynTestModule { |
7 | void test { |
8 | LS list = ll("a", "b", "a", "b"); |
9 | LS sublist = subList(list, 2, 4); |
10 | |
11 | // Note that we couldn't find this out without the magic trick |
12 | // (comparison by elements would yield 0 instead of 2). |
13 | assertEqualsVerbose("Index", 2, magicIndexOfSubList(list, sublist)); |
14 | assertEqualsVerbose("Index", 0, magicIndexOfSubList(list, list)); |
15 | |
16 | LS sublist2 = subList(sublist, 1, 2); |
17 | print(className(sublist2)); |
18 | assertEqualsVerbose("Index", 1, magicIndexOfSubList(sublist, sublist2)); |
19 | assertEqualsVerbose("Index", 3, magicIndexOfSubList(list, sublist2)); |
20 | assertEqualsVerbose("Index", -1, magicIndexOfSubList(list, subList(ll("a", "b"), 0, 1))); |
21 | |
22 | } |
23 | } |
Began life as a copy of #1001831
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1031889 |
Snippet name: | Test magicIndexOfSubList with OurSubLists (OK) |
Eternal ID of this version: | #1031889/8 |
Text MD5: | 482d2c934c3e6428de4788c6fb27c5b1 |
Transpilation MD5: | 7a3a486ca3e8e8fcd51699d19cb72030 |
Author: | stefan |
Category: | |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-07-24 02:50:34 |
Source code size: | 797 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 164 / 295 |
Version history: | 7 change(s) |
Referenced in: | [show references] |