Libraryless. Click here for Pure Java version (14582L/92K).
!7 set flag OurSubLists. set flag NoIllegalAccesses. module > DynTestModule { void test { LS list = ll("a", "b", "a", "b"); LS sublist = subList(list, 2, 4); // Note that we couldn't find this out without the magic trick // (comparison by elements would yield 0 instead of 2). assertEqualsVerbose("Index", 2, magicIndexOfSubList(list, sublist)); assertEqualsVerbose("Index", 0, magicIndexOfSubList(list, list)); LS sublist2 = subList(sublist, 1, 2); print(className(sublist2)); assertEqualsVerbose("Index", 1, magicIndexOfSubList(sublist, sublist2)); assertEqualsVerbose("Index", 3, magicIndexOfSubList(list, sublist2)); assertEqualsVerbose("Index", -1, magicIndexOfSubList(list, subList(ll("a", "b"), 0, 1))); } }
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: | 448 / 634 |
| Version history: | 7 change(s) |
| Referenced in: | [show references] |