def test_user_input(self): filename = "input.txt" f = open(filename, "r") inParams = InputParameters.get_input(f) f.close() validinput = InputConstraints.input_constraints(inParams, calledfunc) self.assertTrue(validinput, "Input parameters are not valid.")
def test_input(self): filename = "input.txt" f = open(filename, "r") inParams = InputParameters.get_input(f) f.close() assert inParams == (500.0, 3.0, 3.0, 45, 45), "Something wrong in the InputParameters.py"
def test_invalid_angle(self): filename = "testcase_invalidangle.txt" f = open(filename, "r") for x in range(6): f.readline() inParams = InputParameters.get_input(f) validinput = InputConstraints.input_constraints( inParams, calledfunc) self.assertFalse(validinput, "Angle is out of bound. It should be false.") f.close()
## \file Control.py # \author Thulasi Jegatheesan # \brief Controls the flow of the program import sys import InputParameters import OutputFormat filename = sys.argv[1] A_C, C_W, h_C, T_init, t_final, L, T_C, t_step, rho_W, D, A_tol, R_tol, T_W, E_W = InputParameters.get_input( filename) InputParameters.input_constraints(A_C, C_W, h_C, T_init, t_final, L, T_C, t_step, rho_W, D, T_W, E_W) OutputFormat.write_output(T_W, E_W)
import Calculations import InputConstraints import InputParameters import OutputFormat # start timer start = time.time() # start coverage cov = coverage.Coverage() cov.start() filename = sys.argv[1] f = open(filename, "r") # read input (F_1, X_1, X_2, theta_1, theta_2) = InputParameters.get_input(f) f.close() inParams = (F_1, X_1, X_2, theta_1, theta_2) calledfunc = "Control" # do the calculationsif inputs are valid if (InputConstraints.input_constraints(inParams, calledfunc)): (F_Ax, F_Ay, F_By) = InputParameters.derived_values(F_1, X_1, X_2) F_AC = Calculations.func_F_AC(F_Ay, theta_1) F_AD = Calculations.func_F_AD(F_AC, theta_1) F_BC = Calculations.func_F_BC(F_By, theta_2) F_BD = Calculations.func_F_BD(F_BC, theta_2) F_CD = Calculations.func_F_CD(F_1) OutputFormat.write_output(F_AC, F_AD, F_BC, F_BD, F_CD) cov.stop()
## \file Control.py # \author Naveen Ganesh Muralidharan # \brief Controls the flow of the program import sys import Calculations import InputParameters import OutputFormat filename = sys.argv[1] r_t, K_d, K_p, t_step, t_sim = InputParameters.get_input(filename) InputParameters.input_constraints(r_t, K_d, K_p, t_step, t_sim) y_t = Calculations.func_y_t(K_d, K_p, r_t, t_sim, t_step) OutputFormat.write_output(y_t)