def test_subEqualPositivePositive(self): #positive number & positive number assert m.subtraction(10, 3) == 7 assert m.subtraction(4, 3) == 1 assert m.subtraction(8, 4) == 4 assert m.subtraction(15, 6) == 9 assert m.subtraction(53, 25) == 28 assert m.subtraction(70, 42) == 28 assert m.subtraction(130, 65) == 65 assert m.subtraction(1111, 111) == 1000 assert m.subtraction(25485, 10254) == 15231
def test_subNotEqualPositiveNegative(self): #positive number & negative number assert m.subtraction(-22, 311) != -111 assert m.subtraction(-564, 80) != 40 assert m.subtraction(10, -7) != 45 assert m.subtraction(-12, 110) != 100 assert m.subtraction(45, -5) != -12 assert m.subtraction(-74, 51) != -9 assert m.subtraction(-25, 25) != 0 assert m.subtraction(100, -103564) != 0
def equalClick(self): """ Funkcia na vyhodnotenie zadaného príkladu v kalkulačke. Volá funkcie z matematickej knižnice mathlib.py """ global operatorFlag global operator global leftSide global rightSide global errorFlag global leftSideValue global rightSideValue rightSideValue = SideValue(rightSide) leftSideValue = SideValue(leftSide) result = "" if errorFlag: result = "Invalid input" else: if not leftSide: result = "Invalid input" #calling functions from mathlib based on operator value elif '!' in operator: result = m.factorial(leftSideValue) elif not rightSide: result = "Invalid input" elif '+' in operator: result = m.add(leftSideValue, rightSideValue) elif '-' in operator: result = m.subtraction(leftSideValue, rightSideValue) elif '*' in operator: result = m.multiplication(leftSideValue, rightSideValue) elif '/' in operator: result = m.divide(leftSideValue, rightSideValue) elif '^' in operator: result = m.power(leftSideValue, rightSideValue) elif '\u221A' in operator: #root symbol result = m.nthRoot(leftSideValue, rightSideValue) elif '%' in operator: result = m.modulo(leftSideValue, rightSideValue) if not operator and leftSide and not rightSide: # if user inserted only one number without operator result = leftSideValue self.ui.resultDisplay.setText(str(result)) clearEverything()
def test_subNotEqualPositivePositive(self): #positive number & positive number assert m.subtraction(2, 4) != 0 assert m.subtraction(70, 30) != 15 assert m.subtraction(2100, 181) != 171 assert m.subtraction(100, 107) != 7 assert m.subtraction(40, 111) != -1044524 assert m.subtraction(4025, 46555) != 0.5 assert m.subtraction(1484910, 6515612) != -1
def Standard_deviation(): """ Funkcia na výpočet smerodajnej odchýlky zo štandardného vstupu(stdin) :return: výslednú smerodajnú odchýlku pre zadané čísla """ global N sumSX = 0 sumSX2 = 0 for line in sys.stdin: strip = int(line.rstrip()) N = m.add(N, 1) sumSX = m.add(sumSX, strip) sumSX2 = m.add(sumSX2, m.power(strip, 2)) x_line = m.multiplication(m.divide(1, N), sumSX) multInBracket = m.multiplication(N, m.power(x_line, 2)) bracket = m.subtraction(sumSX2, multInBracket) leftSide = m.divide(1, m.subtraction(N, 1)) multOutBracket = m.multiplication(leftSide, bracket) result = m.nthRoot(2, multOutBracket) return result
def test_subNotEqualNegativeNegative(self): #negative number & negative number assert m.subtraction(-2, -3) != 0 assert m.subtraction(-5, -1) != -27.5 assert m.subtraction(-13, -7) != -46 assert m.subtraction(-40, -11) != 10 assert m.subtraction(-4025, -46555) != 3.33 assert m.subtraction(-1480.45, -6515612) != -12314
def test_subEqualNegativeNegative(self): #negative number & negative number assert m.subtraction(-5, -8) == 3 assert m.subtraction(-30, -18) == -12 assert m.subtraction(-3, -7) == 4 assert m.subtraction(-301, -121) == -180 assert m.subtraction(-1025, -2555) == 1530 assert m.subtraction(-19796, -20123) == 327
def test_subEqualPositiveNegative(self): #positive number & negative number assert m.subtraction(5, -3) == 8 assert m.subtraction(10, -5) == 15 assert m.subtraction(2, -8) == 10 assert m.subtraction(2, -1) == 3 assert m.subtraction(-8, 9) == -17 assert m.subtraction(2, -6) == 8 assert m.subtraction(-15, 15) == -30 assert m.subtraction(-253, 100) == -353 assert m.subtraction(35, -77) == 112 assert m.subtraction(2566, -1120) == 3686 assert m.subtraction(-9999, 1111) == -11110