feat: move List.contains to Sequence.contains and add tests for List and Range
The contains method is promoted from List to the Sequence base class, making it available to all sequence types (including Range). Tests are added for both List.contains and Range.contains, covering ordered, backwards, and exclusive ranges.
This commit is contained in:
+9
-9
@@ -45,6 +45,15 @@
|
||||
// This string literal is generated automatically from core. Do not edit.
|
||||
static const char* libSource =
|
||||
"class Sequence {\n"
|
||||
" contains(element) {\n"
|
||||
" for (item in this) {\n"
|
||||
" if (element == item) {\n"
|
||||
" return true\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" return false\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" count {\n"
|
||||
" var result = 0\n"
|
||||
" for (element in this) {\n"
|
||||
@@ -138,15 +147,6 @@ static const char* libSource =
|
||||
" }\n"
|
||||
" return result\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" contains(element) {\n"
|
||||
" for (item in this) {\n"
|
||||
" if (element == item) {\n"
|
||||
" return true\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" return false\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"class Map {\n"
|
||||
|
||||
Reference in New Issue
Block a user