Skip to content

Commit 1d72ef4

Browse files
authored
series: Add test for slice length way bigger than series length (#2093)
The need for such a case arises from languages with bounded integer types like Rust where the specific edge case (slice length equals series length plus one) can be solved by unstable solutions that would overflow for any greater slice length input. For instance, in Rust, with no type casting, computing `digits.len() + 1 - len` will panic for `len > 6`.
1 parent 044e6a1 commit 1d72ef4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

exercises/series/canonical-data.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@
8282
"error": "slice length cannot be greater than series length"
8383
}
8484
},
85+
{
86+
"uuid": "d7957455-346d-4e47-8e4b-87ed1564c6d7",
87+
"description": "slice length is way too large",
88+
"property": "slices",
89+
"input": {
90+
"series": "12345",
91+
"sliceLength": 42
92+
},
93+
"expected": {
94+
"error": "slice length cannot be greater than series length"
95+
}
96+
},
8597
{
8698
"uuid": "d34004ad-8765-4c09-8ba1-ada8ce776806",
8799
"description": "slice length cannot be zero",

0 commit comments

Comments
 (0)