コード例 #1
0
	def test_fib_length(self):
		self.assertEqual(len(problem4_fib.fib_gen(5)), 5, msg = "Checking length of sequence for 5")
		self.assertEqual(len(problem4_fib.fib_gen(13)), 13, "Checking length of sequence")
		self.assertEqual(len(problem4_fib.fib_gen(6)), 6, msg = "Checking length of sequence for 6")
		self.assertEqual(len(problem4_fib.fib_odd(5)), 5, msg = "Checking length of sequence for 6")
		self.assertEqual(len(problem4_fib.fib_even(6)), 6, msg = "Checking length of sequence for 6")
		self.assertEqual(len(problem4_fib.fib_odd(7)), 7, msg = "Checking length of sequence for 6")
		self.assertEqual(len(problem4_fib.fib_even(8)), 8, msg = "Checking length of sequence for 6")
コード例 #2
0
	def test_fib_gen(self):
		self.assertEqual(problem4_fib.fib_gen(5), [0, 1, 1, 2, 3], msg = "Checking results for 5")
		self.assertEqual(problem4_fib.fib_gen(9), [0, 1, 1, 2, 3, 5, 8, 13, 21], msg = "Checking results for 9")