We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec7bf4d commit ca1518fCopy full SHA for ca1518f
puzzles/arrays/candy/test_candy.py
@@ -1,18 +1,21 @@
1
import unittest
2
-
3
-from . import candy
+from typing import List
+from parameterized import parameterized
4
+from puzzles.arrays.candy import candy
5
6
7
class CandyTestCase(unittest.TestCase):
- def test_1(self):
8
- ratings = [1, 0, 2]
9
- expected = 5
10
- actual = candy(ratings)
11
- self.assertEqual(expected, actual)
12
13
- def test_2(self):
14
- ratings = [1, 2, 2]
15
- expected = 4
+ @parameterized.expand([
+ ([1], 1),
+ ([1, 0, 2], 5),
+ ([1, 2, 2], 4),
+ ([1,3,4,5,2], 11),
+ ([1,2,3,4,5], 15),
+ ([5,4,3,2,1], 15),
16
+ ([5,5,5,5,5,5,5,5], 8),
17
+ ])
18
+ def test_candy(self, ratings: List[int], expected: int):
19
actual = candy(ratings)
20
self.assertEqual(expected, actual)
21
0 commit comments