Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Start by getting the files. Type 2 6 4 get hw 0 5 and then cd hw 0 5 from bash. You will find only
Start by getting the files. Type get hw and then cd hw from bash. You will find only one file: mintf.h That is the header file. It defines the signature of two of the functions you will implement: mintf and printinteger You will be creating three new files: mintf.c testmintf.c and testmintf.txt There is no starter code other than the header file mintf.c is where your mintf and printinteger implementations will go Copy your printinteger from HW into it Copy the function signature for mintf from mintf.h into mintf.c Make sure all of the following headers are included at the top of your mintf.cType these manually into your file. #include #include #include #include "mintf.h testmintf.c will contain a main function that will test your mintf and printinteger It must exercise all of the functionality in those two functions. For this homework, that means that in the course of running your testmintf.c file, every line of code in your mintf.c should be executed at some point. To do this, you simply have several mintf that include all of the format codes above, including a variety of valid values, including positive integers, negative integers, strings, and an empty string. It should also have a few printinteger statements to test that on its own. This will give you a very simple way to know for sure if your code works. Use testdriven development to do this assignment incrementally. testmintf.txt will contain the expected output from running your tests in testmintf.c It will be a simple text file. To test if your code works perfectly, you will run the following: gcc testmintf.c mintf.c o testmintf # compile your test together with your mintf.c to create an executable called testmintf testmintf testmintf.actual # run your executable and send the output to a file called testmintf.actual That filename is arbitrary. diff testmintf.actual testmintf.txt # compare the actual output with the expected output using the diff command The diff command prints the differences so if you see any output at all, then your test failed. If you see no output, then it passed. gcc testmintf.c mintf.c o testmintf && testmintf diff testmintf.txt
Start by getting the files. Type get hw and then cd hw from bash.
You will find only one file: mintf.h That is the header file. It defines the signature of two of the functions you will implement: mintf and printinteger
You will be creating three new files: mintf.c testmintf.c and testmintf.txt There is no starter code other than the header file
mintf.c is where your mintf and printinteger implementations will go Copy your printinteger from HW into it Copy the function signature for mintf from mintf.h into mintf.c Make sure all of the following headers are included at the top of your mintf.cType these manually into your file.
#include
#include
#include
#include "mintf.h
testmintf.c will contain a main function that will test your mintf and printinteger It must exercise all of the functionality in those two functions. For this homework, that means that in the course of running your testmintf.c file, every line of code in your mintf.c should be executed at some point. To do this, you simply have several mintf that include all of the format codes above, including a variety of valid values, including positive integers, negative integers, strings, and an empty string. It should also have a few printinteger statements to test that on its own. This will give you a very simple way to know for sure if your code works.
Use testdriven development to do this assignment incrementally.
testmintf.txt will contain the expected output from running your tests in testmintf.c It will be a simple text file.
To test if your code works perfectly, you will run the following:
gcc testmintf.c mintf.c o testmintf # compile your test together with your mintf.c to create an executable called testmintf
testmintf testmintf.actual # run your executable and send the output to a file called testmintf.actual That filename is arbitrary.
diff testmintf.actual testmintf.txt # compare the actual output with the expected output using the diff command
The diff command prints the differences so if you see any output at all, then your test failed. If you see no output, then it passed.
gcc testmintf.c mintf.c o testmintf && testmintf diff testmintf.txt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started