コード例 #1
0
 def test_sqroot(self):
     dir_path = os.path.dirname(os.path.realpath(__file__))
     csvRead = CsvReader()
     test_data = csvRead.loadData(dir_path +
                                  '\\csv_test\\Unit Test Square Root.csv')
     calc = Calculator()
     for row in test_data:
         res = calc.sqrt(row['Value 1'])
         exp = float(row['Result'])
         self.assertEqual(round(res, 5), round(exp, 5))
コード例 #2
0
 def test_multiplication(self):
     dir_path = os.path.dirname(os.path.realpath(__file__))
     csvRead = CsvReader()
     test_data = csvRead.loadData(
         dir_path + '\\csv_test\\Unit Test Multiplication.csv')
     calc = Calculator()
     for row in test_data:
         res = calc.multiply(row['Value 1'], row['Value 2'])
         exp = int(row['Result'])
         self.assertEqual(res, exp)