def run_tests(): print('running tests...') command_and_args_ = [ './build/release/amara', 'run', 'tests', '--no-banner'] dev_null_ = open(os_devnull, 'w') command_ = subprocess.Popen( command_and_args_, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=dev_null_) child_ = pexpect_fdpexpect_fdspawn(command_.stdout) child_.expect('Running tests...\n... done\n') if not PY2: child_.close() dev_null_.close()
def naturals_substraction(): print('running example naturals_substraction...') command_and_args_ = [ './build/release/amara', 'run', 'app', 'examples/2_naturals_substraction/', '--no-banner'] dev_null_ = open(os_devnull, 'w') command_ = subprocess.Popen( command_and_args_, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=dev_null_) child_ = pexpect_fdpexpect_fdspawn(command_.stdout) child_.expect('9 minus 2 equals to 7, which is of type natural') if not PY2: child_.close() dev_null_.close()
def functions_structure(): print('running example functions_structure...') command_and_args_ = [ './build/release/amara', 'run', 'app', 'examples/1_functions_structure/', '--no-banner'] dev_null_ = open(os_devnull, 'w') command_ = subprocess.Popen( command_and_args_, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=dev_null_) child_ = pexpect_fdpexpect_fdspawn(command_.stdout) child_.expect('hello, world') if not PY2: child_.close() dev_null_.close()
def combine_math_operators_substraction_and_division(): print('running example combine_math_operators_substraction_and_division...') command_and_args_ = [ './build/release/amara', 'run', 'app', 'examples/5_combine_math_operators_substraction_and_division/', '--no-banner'] dev_null_ = open(os_devnull, 'w') command_ = subprocess.Popen( command_and_args_, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=dev_null_) child_ = pexpect_fdpexpect_fdspawn(command_.stdout) child_.expect('38 minus 20 divided by 4 equals to 33, with type natural') if not PY2: child_.close() dev_null_.close()
def naturals_division(): print('running example naturals_division...') command_and_args_ = [ './build/release/amara', 'run', 'app', 'examples/3_naturals_division/', '--no-banner'] dev_null_ = open(os_devnull, 'w') command_ = subprocess.Popen( command_and_args_, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=dev_null_) child_ = pexpect_fdpexpect_fdspawn(command_.stdout) child_.expect('18 divided by 3 equals to 6, with type natural') if not PY2: child_.close() dev_null_.close()
def fahrenheit_to_celsius_static(): print('running example fahrenheit_to_celsius_static...') command_and_args_ = [ './build/release/amara', 'run', 'app', 'examples/6_fahrenheit_to_celsius_literal/', '--no-banner'] dev_null_ = open(os_devnull, 'w') command_ = subprocess.Popen( command_and_args_, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=dev_null_) child_ = pexpect_fdpexpect_fdspawn(command_.stdout) child_.expect('99 degrees Fahrenheit equals to 37') child_.expect('(with type "natural")') child_.expect('degrees Celsius using the formula:') child_.expect('(99 minus 32)') child_.expect('times 5 divided by 9') child_.expect('=') child_.expect('37') if not PY2: child_.close() dev_null_.close()