def test_add(self):
        ''' Tests the add function. '''

        self.assertEqual(maths.add(4, 8), 12)
        self.assertEqual(maths.add(5, 12, None), 17)
        self.assertEqual(maths.add(6, 23, 6), '45')
        self.assertEqual(maths.add(88, 45, 16), '85')
 def test_add(self):
     self.assertEqual(maths.add(1, 2), 3, "Numbers were not added properly")
     self.assertEqual(maths.add(17, 14, 12), 27,
                      "Numbers not added over base 10 properly")
     self.assertEqual(maths.add(10, 12, 8), 26,
                      "Numbers not added under base 11 properly")
     ''' Tests the add function. '''
Beispiel #3
0
 def test_add(self):
     ''' Tests the add function. '''
     t = maths.add(1,2)
     t2 = maths.add(10,2,0)
     
     self.assertEqual(t,3)
     self.assertEqual(t2,'1010')
Beispiel #4
0
 def test_add(self):
     ''' Tests the add function. '''
     add_result = maths.add(15, 16)
     self.assertEqual(31, add_result, "add function is wrong")
     base_result = maths.add(4, 6, 2)
     self.assertEqual(1010, base_result,
                      "add function base test under 10 is wrong")
     new_base_result = maths.add(10, 16, 16)
     self.assertEqual("1A", new_base_result,
                      "add function base test pass over 10 is wrong")
 def test_add(self):
     ''' Tests the add function. '''
     # Arrange
     result = maths.add(2, 3)
     result1 = maths.add(1,0)
     result2 = maths.add(-1,1)
     # Act
     
     # Assert
     self.assertEqual(result, 5)
     self.assertEqual(result1,1)
     self.assertEqual(result2,0)
 def test_add(self):
     ''' Tests the add function. '''
     #arrange
     a = maths.add(1, 2)
     #assert
     self.assertEqual(a, 3)
     '''task 2'''
     #arrange
     e = maths.add(1, 2, 2)
     f = maths.add(10, 20, 15)
     #assert
     self.assertEqual(e, 11)
     self.assertEqual(f, 20)
    def test_add(self):
        ''' Tests the add function. '''
        result = maths.add(5, 7)
        self.assertEqual(12, result, "fail the test")

        result_base2 = maths.add(10, 11, 2)
        self.assertEqual(10101, result_base2, "fail the test")

        result_base16 = maths.add(10, 11, 16)
        self.assertEqual(15, result_base16, "fail the test")

        result_base16 = maths.add(15, 16, 16)
        self.assertEqual("1F", result_base16, "fail the test")
Beispiel #8
0
 def test_add(self):
     ''' Tests the add function. '''
     #Arrange
     num1 = 6
     num2 = 4
     n = 16
     
     #Act
     act = maths.add(num1, num2)
     act2 = maths.add(num1, num2, n)
     
     #Assert
     self.assertEqual(act, '10')
     self.assertEqual(act2, "A")
 def test_add_convert_high(self):
     '''tests the add with the added conversion for a base over 10 '''
     #act
     result = maths.add(5, 10, 12)
     #assert
     self.assertEqual(result, 13,
                      "The add function returned an incorrect value!")
 def test_add_convert_low(self):
     '''tests the add with the added conversion for a base less than 10 '''
     #act
     result = maths.add(5, 5, 5)
     #assert
     self.assertEqual(result, 20,
                      "The add function returned an incorrect value!")
Beispiel #11
0
    def test_add_optional_parameter_under10(self):
        #Arrange
        #Act
        value = maths.add(10, 30, 8)

        #Assert
        self.assertEqual(50, value)
 def test_add(self):
     ''' Tests the add function. '''
     #act
     result = maths.add(5, 5)
     #assert
     self.assertEqual(result, 10,
                      "The add function returned an incorrect value!")
Beispiel #13
0
    def test_add_optional_parameter_over10(self):
        #Arrange
        #Act
        value = maths.add(10, 30, 12)

        #Assert
        self.assertEqual(34, value)
 def test_add(self):
     ''' Tests the add function. '''
     # Arrange & Act
     result = maths.add(3, 4)
     # Assert
     self.assertEqual(result, 7,
                      "The add function returned an incorrect value.")
 def test_add_with_base_over_ten(self):
     ''' Tests the add function with the optional base parameter given, which is over ten '''
     # Arrange & Act
     result = maths.add(5, 5, 12)
     # Assert
     self.assertEqual(result, 'A',
                      "The add function returned an incorrect value.")
 def test_add_with_no_base_parameter(self):
     ''' Tests the add function with no base parameter given '''
     # Arrange & Act
     result = maths.add(5, 5)
     # Assert
     self.assertEqual(result, 10,
                      "The add function returned an incorrect value.")
    def test_add(self):
        ''' Tests the add function. '''
        first = 3
        second = 6
        n = 10
        self.assertEqual(maths.add(first, second, n), first + second, n)

        pass  # TODO
Beispiel #18
0
    def test_add(self):
        ''' Tests the add function. '''
        #Arrange
        #Act
        value = maths.add(1, 2)

        #Assert
        self.assertEqual(3, value)
Beispiel #19
0
    def test_add(self):
        ''' Tests the add function. '''
        num_1 = 3
        num_2 = 5
        expected = 8

        result = maths.add(num_1, num_2)

        self.assertEqual(expected, result, "Expects an 8")
Beispiel #20
0
    def test_add(self):
        ''' Tests the add function. '''
        # Arrange
        a = maths.add(1, 2)

        # Act

        # Assert
        self.assertEqual(a, 3)
Beispiel #21
0
 def test_add(self):
     ''' Tests the add function. '''
     #Arrange
     first = 1
     second = 2
     #Act
     self.equal = maths.add(first, second)
     #Assert
     self.assertEqual(3, self.equal, "Expects 3")       
Beispiel #22
0
    def test_add_convert(self):
        ''' Tests the convert_base of the add function. '''
        # Arrange
        a = maths.add(1, 2, 1)

        # Act
        b = maths.convert_base(3, 1)

        # Assert
        self.assertEqual(a, b)
 def test_add(self):
     
     #Arrange
     first = 2
     second = 3
     
     #Act
     result = maths.add(first, second)
     
     #Assert
     self.assertEqual(result, 5)
Beispiel #24
0
 def test_add(self):
     ''' Tests the add function. '''
     #Arrange
     x = 1
     y = 2
     a = maths.add(x, y)
     #Act
     #Assert
     self.assertEqual(a, x + y, "success")
     print("add test finish")
     pass  # TODO
Beispiel #25
0
    def test_add_base_over10(self):
        first = 2
        second = 6
        n = 16

        add = maths.add(first, second, n)

        if add == maths.convert_base(first + second, n):
            pass
        else:
            self.fail('test failed')
Beispiel #26
0
    def test_add(self):
        ''' Tests the add function. '''

        # Arrange

        test_1 = maths.add(2, 3)
        test_2 = maths.add(5, 7)
        test_3 = maths.add(test_1, test_2)

        test_4 = maths.add(5, 3, 2)
        test_5 = maths.add(5, 5, 16)

        # Act
        print('\n Add function \n',
              '=' * 60,
              '\n',
              'Add function - Test 1 result: ',
              test_1,
              '\n',
              'Add function - Test 2 result: ',
              test_2,
              '\n',
              'Add function - Test 3 result: ',
              test_3,
              '\n',
              'Add function - Test 4 result: ',
              test_4,
              '\n',
              'Add function - Test 5 result: ',
              test_5,
              '\n',
              '=' * 60,
              sep='')

        # Assert

        self.assertEqual(test_1, 5, msg=error_message)
        self.assertEqual(test_2, 12, msg=error_message)
        self.assertEqual(test_3, 17, msg=error_message)
        self.assertEqual(test_4, '1000', msg=error_message)
        self.assertEqual(test_5, 'A', msg=error_message)
Beispiel #27
0
    def test_add(self):
        ''' Tests the add function. '''
        #Arrange
        first = 2
        second = 3

        #Act
        result = maths.add(first, second)

        #Assert
        self.assertEqual(result, 5)
        pass  # TODO
Beispiel #28
0
    def test_add(self):
        ''' Tests the add function. '''
        # Arrange
        first = 10
        second = 5
        expected = 15

        # Act
        result = maths.add(first, second)

        #Assert
        self.assertEqual(result, expected)
 def test_optional_parameter_add(self):
     
     #Arrange
     first = 10
     second = 5
     n = 2
     
     #Act
     result = maths.add(first, second, n)
     
     #Assert     
     self.assertEqual(result, '1111')
Beispiel #30
0
 def test_add1(self):
     ''' Tests the add function. '''
     #Arrange
     x = 10
     y = 2
     n = 16
     a = maths.add(x, y, n)
     #Act
     #Assert
     self.assertEqual(a, "C", "success")
     print("add test 1 finish")
     pass  # TODO
Beispiel #31
0
 def test_two_two(self):
     state.append('test_pak.test_sub.test_mod.TestMaths.test_two_two')
     assert maths.mult(2, 2) == maths.add(2, 2)
Beispiel #32
0
def test_add():
    print("MOD.test_add called", state, id(state))
    state.append('test_pak.test_mod.test_add')
    assert maths.add(1, 2) == 3
	def test_add(self):
		self.assertEqual(maths.add(1,2),3)
		self.assertFalse(maths.add(1,2)==4)
		self.assertTrue(maths.add(2,2)==4)
Beispiel #34
0
def test():
    state.append('test_pak.test_sub.test_mod.test')
    assert maths.add(1, 2) == 3