Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In part C (the final part of the assignment) you will be writing a program in python for testing if executables are compiling and running

In part C (the final part of the assignment) you will be writing a program in python for testing if executables are compiling and running correctly. For this particular PA, you should use it to test out the pythagorean.c program. In future assignments, you can re-use this program to test out other PAs. You are also welcome to add additional features to it in the future, though for the purpose of this PA you should stick to only the features described in the spec. The program you will write should be named sbt.py (Super Basic Tester) and should be located in the sbt directory within the pa1 directory, as indicated in the assignment summary. This program should accept two input values via standard input. The first will be the path / name of the .c file that it will be testing. The second will be the path / name to a directory containing test cases for the program. Your program should expect that the test directory will have the following structure:

image text in transcribedThe test directory should contain 0 or more directories within it, with names that correspond to what the name of that particular test. Each of these directories should have exactly two files within it named input.txt and output.txt. input.txt should contain whatever content you want to be sent as the standard input to the program being tested for this case. output.txt should contain the exact test that you expect your program to produce, given the corresponding standard input from input.txt. The outline of what this python program should do is as follows: 1. Ask the user for the two input values (.c file name and test directory) 2. Run a command to compile the .c program ( gcc -Wall -Werror -stc=c11 FILE.c ) 3. If the compilation failed for any reason, print "failed to compile your code" and then exit. 4. If it worked, loop through each of the directories within the test directory folder 5. For each one: a. Run the executable and give it the standard input text from input.txt b. Store / save what it prints to standard output c. Compare the result with the contents of the output.txt file d. If the same, print "#### Test: DIR_NAME passed! ####" e. If different, print "#### Test: DIR_NAME failed! ####" and then print out a comparison of the results.

test_directory test-A - 1 input.txt output.txt test-B F input.txt output.txt test_directory test-A - 1 input.txt output.txt test-B F input.txt output.txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

dy dx Find the derivative of the function y=(4x+3)5(2x+1)2.

Answered: 1 week ago