2023-07-15 15:27:31 -07:00
|
|
|
# These tests are auto-generated with test data from:
|
|
|
|
|
# https://github.com/exercism/problem-specifications/tree/main/exercises/difference-of-squares/canonical-data.json
|
|
|
|
|
# File last updated on 2023-07-15
|
|
|
|
|
|
2014-03-18 20:46:15 +01:00
|
|
|
import unittest
|
|
|
|
|
|
2021-01-31 16:49:12 -05:00
|
|
|
from difference_of_squares import (
|
|
|
|
|
difference_of_squares,
|
|
|
|
|
square_of_sum,
|
|
|
|
|
sum_of_squares,
|
|
|
|
|
)
|
2014-03-18 20:46:15 +01:00
|
|
|
|
2019-10-06 20:29:45 +05:30
|
|
|
|
2017-03-21 17:02:00 +01:00
|
|
|
class DifferenceOfSquaresTest(unittest.TestCase):
|
2017-05-17 17:39:54 +02:00
|
|
|
def test_square_of_sum_1(self):
|
|
|
|
|
self.assertEqual(square_of_sum(1), 1)
|
|
|
|
|
|
2014-03-18 20:46:15 +01:00
|
|
|
def test_square_of_sum_5(self):
|
2017-03-21 17:02:00 +01:00
|
|
|
self.assertEqual(square_of_sum(5), 225)
|
2014-03-18 20:46:15 +01:00
|
|
|
|
|
|
|
|
def test_square_of_sum_100(self):
|
2017-03-21 17:02:00 +01:00
|
|
|
self.assertEqual(square_of_sum(100), 25502500)
|
|
|
|
|
|
2017-05-17 17:39:54 +02:00
|
|
|
def test_sum_of_squares_1(self):
|
|
|
|
|
self.assertEqual(sum_of_squares(1), 1)
|
|
|
|
|
|
2017-03-21 17:02:00 +01:00
|
|
|
def test_sum_of_squares_5(self):
|
|
|
|
|
self.assertEqual(sum_of_squares(5), 55)
|
|
|
|
|
|
2014-03-18 20:46:15 +01:00
|
|
|
def test_sum_of_squares_100(self):
|
2017-03-21 17:02:00 +01:00
|
|
|
self.assertEqual(sum_of_squares(100), 338350)
|
|
|
|
|
|
2017-05-17 17:39:54 +02:00
|
|
|
def test_difference_of_squares_1(self):
|
2019-05-31 12:12:54 -07:00
|
|
|
self.assertEqual(difference_of_squares(1), 0)
|
2017-03-21 17:02:00 +01:00
|
|
|
|
|
|
|
|
def test_difference_of_squares_5(self):
|
2019-05-31 12:12:54 -07:00
|
|
|
self.assertEqual(difference_of_squares(5), 170)
|
2017-03-21 17:02:00 +01:00
|
|
|
|
|
|
|
|
def test_difference_of_squares_100(self):
|
2019-05-31 12:12:54 -07:00
|
|
|
self.assertEqual(difference_of_squares(100), 25164150)
|