forked from MIT-Emerging-Talent/ET6-practice-code-review
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add the test for solution tribonacci sequence
- Loading branch information
1 parent
912afb9
commit 5ae1651
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import unittest | ||
|
||
from solutions.the_tribonacci_sequence.main import tribonacci | ||
|
||
|
||
class TestTribonacci(unittest.TestCase): | ||
"""Test suite for the tribonacci function.""" | ||
|
||
def test_base_cases(self): | ||
"""Test the base cases.""" | ||
self.assertEqual(tribonacci(0), 0) # Base case T(0) | ||
self.assertEqual(tribonacci(1), 1) # Base case T(1) | ||
self.assertEqual(tribonacci(2), 1) # Base case T(2) | ||
|
||
def test_standard_cases(self): | ||
"""Test standard cases.""" | ||
self.assertEqual(tribonacci(3), 2) # 0, 1, 1, 2 | ||
self.assertEqual(tribonacci(4), 4) # 0, 1, 1, 2, 4 | ||
self.assertEqual(tribonacci(5), 7) # 0, 1, 1, 2, 4, 7 | ||
self.assertEqual(tribonacci(6), 13) # 0, 1, 1, 2, 4, 7, 13 | ||
|
||
def test_large_values(self): | ||
"""Test for larger values of n.""" | ||
self.assertEqual(tribonacci(10), 149) # Verify correct calculation for T(10) | ||
self.assertEqual(tribonacci(15), 3136) # Verify correct calculation for T(15) | ||
|
||
def test_edge_cases(self): | ||
"""Test edge cases.""" | ||
self.assertEqual(tribonacci(30), 29249425) # Large n value |
Empty file.