From 62998f3d831b31bcf3203585d75abccc6961e935 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 13 Nov 2024 08:45:58 +0100 Subject: [PATCH 1/2] largest-series-product: add test comments on separate line --- .../practice/largest-series-product/tests.ua | 59 ++++++++++++++----- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/exercises/practice/largest-series-product/tests.ua b/exercises/practice/largest-series-product/tests.ua index f5a3f6b..9d0d7d3 100644 --- a/exercises/practice/largest-series-product/tests.ua +++ b/exercises/practice/largest-series-product/tests.ua @@ -1,17 +1,46 @@ ~ "largest-series-product.ua" ~ LargestProduct -⍤⤙≍ 18 LargestProduct "29" 2 # finds the largest product if span equals length -⍤⤙≍ 72 LargestProduct "0123456789" 2 # can find the largest product of 2 with numbers in order -⍤⤙≍ 48 LargestProduct "576802143" 2 # can find the largest product of 2 -⍤⤙≍ 504 LargestProduct "0123456789" 3 # can find the largest product of 3 with numbers in order -⍤⤙≍ 270 LargestProduct "1027839564" 3 # can find the largest product of 3 -⍤⤙≍ 15120 LargestProduct "0123456789" 5 # can find the largest product of 5 with numbers in order -⍤⤙≍ 23520 LargestProduct "73167176531330624919225119674426574742355349194934" 6 # can get the largest product of a big number -⍤⤙≍ 0 LargestProduct "0000" 2 # reports zero if the only digits are zero -⍤⤙≍ 0 LargestProduct "99099" 3 # reports zero if all spans include zero -⍤⤙≍ "span must be smaller than string length" ⍣(LargestProduct "123" 4) # rejects span longer than string length -⍤⤙≍ 1 LargestProduct "" 0 # reports 1 for empty string and empty product (0-span) -⍤⤙≍ 1 LargestProduct "123" 0 # reports 1 for nonempty string and empty product (0 span) -⍤⤙≍ "span must be smaller than string length" ⍣(LargestProduct "" 1) # rejects empty string and nonzero span # rejects empty string and nonzero span -⍤⤙≍ "invalid character in digits" ⍣(LargestProduct "1234a5" 2) # rejects invalid character in digits -⍤⤙≍ "span must not be negative" ⍣(LargestProduct "12345" ¯1) # rejects negative span +# finds the largest product if span equals length +⍤⤙≍ 18 LargestProduct "29" 2 + +# can find the largest product of 2 with numbers in order +⍤⤙≍ 72 LargestProduct "0123456789" 2 + +# can find the largest product of 2 +⍤⤙≍ 48 LargestProduct "576802143" 2 + +# can find the largest product of 3 with numbers in order +⍤⤙≍ 504 LargestProduct "0123456789" 3 + +# can find the largest product of 3 +⍤⤙≍ 270 LargestProduct "1027839564" 3 + +# can find the largest product of 5 with numbers in order +⍤⤙≍ 15120 LargestProduct "0123456789" 5 + +# can get the largest product of a big number +⍤⤙≍ 23520 LargestProduct "73167176531330624919225119674426574742355349194934" 6 + +# reports zero if the only digits are zero +⍤⤙≍ 0 LargestProduct "0000" 2 + +# reports zero if all spans include zero +⍤⤙≍ 0 LargestProduct "99099" 3 + +# rejects span longer than string length +⍤⤙≍ "span must be smaller than string length" ⍣(LargestProduct "123" 4) + +# reports 1 for empty string and empty product (0-span) +⍤⤙≍ 1 LargestProduct "" 0 + +# reports 1 for nonempty string and empty product (0 span) +⍤⤙≍ 1 LargestProduct "123" 0 + +# rejects empty string and nonzero span # rejects empty string and nonzero span +⍤⤙≍ "span must be smaller than string length" ⍣(LargestProduct "" 1) + +# rejects invalid character in digits +⍤⤙≍ "invalid character in digits" ⍣(LargestProduct "1234a5" 2) + +# rejects negative span +⍤⤙≍ "span must not be negative" ⍣(LargestProduct "12345" ¯1) From bb63585a41c25d5867741597a6e75e31a9a83e3c Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 13 Nov 2024 09:32:39 +0100 Subject: [PATCH 2/2] Update exercises/practice/largest-series-product/tests.ua Co-authored-by: Christian Willner <34183939+vaeng@users.noreply.github.com> --- exercises/practice/largest-series-product/tests.ua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/largest-series-product/tests.ua b/exercises/practice/largest-series-product/tests.ua index 9d0d7d3..cc605aa 100644 --- a/exercises/practice/largest-series-product/tests.ua +++ b/exercises/practice/largest-series-product/tests.ua @@ -36,7 +36,7 @@ # reports 1 for nonempty string and empty product (0 span) ⍤⤙≍ 1 LargestProduct "123" 0 -# rejects empty string and nonzero span # rejects empty string and nonzero span +# rejects empty string and nonzero span ⍤⤙≍ "span must be smaller than string length" ⍣(LargestProduct "" 1) # rejects invalid character in digits