User Tools

Site Tools


haas:spring2017:cprog:projects:mbe0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
haas:spring2017:cprog:projects:mbe0 [2017/02/07 21:22] – [Output Specification] wedgehaas:spring2017:cprog:projects:mbe0 [2017/02/15 15:42] (current) – [Total output comparison] wedge
Line 8: Line 8:
 ======Project: MENTAL MATH - MULTIPLY BY 11 (mbe0)====== ======Project: MENTAL MATH - MULTIPLY BY 11 (mbe0)======
  
 +=====Errata=====
 +
 +  * Added verification section to facilitate project output specification compliance (20170207)
 +  * Added automatic verification subsection to verification section (20170208)
 =====Objective===== =====Objective=====
 To implement a programmatic solution (ie simulation) of a real life process- the mental math trick of multiplying any two- or three-digit number by eleven. To implement a programmatic solution (ie simulation) of a real life process- the mental math trick of multiplying any two- or three-digit number by eleven.
Line 314: Line 318:
 lab46:~/src/cprog/mbe0$  lab46:~/src/cprog/mbe0$ 
 </cli> </cli>
 +
 +====Total output comparison====
 +If you'd like to check if the entirety of your output is correct (especially in relation to spacing), you can do the following.
 +
 +I have saved sample (correct) outputs on the system that you can check against. The following commands will let you do so:
 +
 +===First, save your output to a file===
 +
 +I have saved program outputs for the following inputs:
 +  * 37
 +  * 73
 +  * 128
 +  * 480
 +  * 907
 +  * 933
 +
 +If you run your program with one of these same inputs, you can compare your results for correctness.
 +
 +In the below example, I do this for an input value of 37:
 +
 +<cli>
 +lab46:~/src/cprog/mbe0$ ./mbe0 <<< 37 2>output.37 1>>output.37
 +lab46:~/src/cprog/mbe0$ 
 +</cli>
 +
 +What we have done is fed in the input via a here string (form of STDIN redirect), and then output both STDERR and STDOUT into a common file (appending STDOUT, after the STDERR output).
 +
 +You should now have a file called **output.37** in your current directory.
 +
 +===Next, check it against mine===
 +I have these files (by the same names), saved in the CPROG Public Directory (under the **mbe0** directory).
 +
 +By using the **diff** command, you can see differences, if any. If there are no differences, the output matches (this is good, and what you want).
 +
 +<cli>
 +lab46:~/src/cprog/mbe0$ diff output.37 /var/public/cprog/mbe0/output.37
 +lab46:~/src/cprog/mbe0$ 
 +</cli>
 +
 +If you see output, that means there are differences, and that your output likely isn't in conformance with project specifications.
 +
 +You can repeat this for the other data files (output.73 for an input of 73, etc.)
 +
 +===Isolate just the STDOUT or the STDERR===
 +Additionally, you may want to specifically look at your program's STDOUT or STDERR independent of each other.
 +
 +To do this, you can do the following.
 +
 +To isolate STDOUT and STDERR into separate files, you can do the following:
 +
 +<cli>
 +lab46:~/src/cprog/mbe0$ ./mbe0 <<< 37 1>stdout.37 2>stderr.37
 +lab46:~/src/cprog/mbe0$ 
 +</cli>
 +
 +You can then compare those particular collections of information against my copies (located in the **mbe0** subdirectory of the CPROG Public Directory, by the same file names).
 +====automated verification====
 +I have rigged up **pchk** to work for this project; it will check for differences and compare MD5sum hashes for stderr, stdout, and total (combined) output.
 +
 +Once you have everything complete, this is a good final check to do to ensure everything is in order.
 +
 +<cli>
 +lab46:~/src/cprog/mbe0$ pchk cprog mbe0
 +===================================================
 +=          mbe0 output validation check           =
 +===================================================
 +      stderr diff: MATCH    stderr md5sum: MATCH
 +[ 37] stdout diff: MATCH    stdout md5sum: MATCH
 +      output diff: MATCH    output md5sum: MATCH
 +
 +      stderr diff: MATCH    stderr md5sum: MATCH
 +[ 73] stdout diff: MATCH    stdout md5sum: MATCH
 +      output diff: MATCH    output md5sum: MATCH
 +
 +      stderr diff: MATCH    stderr md5sum: MATCH
 +[128] stdout diff: MATCH    stdout md5sum: MATCH
 +      output diff: MATCH    output md5sum: MATCH
 +
 +      stderr diff: MATCH    stderr md5sum: MATCH
 +[480] stdout diff: MATCH    stdout md5sum: MATCH
 +      output diff: MATCH    output md5sum: MATCH
 +
 +      stderr diff: MATCH    stderr md5sum: MATCH
 +[907] stdout diff: MATCH    stdout md5sum: MATCH
 +      output diff: MATCH    output md5sum: MATCH
 +
 +      stderr diff: MATCH    stderr md5sum: MATCH
 +[933] stdout diff: MATCH    stdout md5sum: MATCH
 +      output diff: MATCH    output md5sum: MATCH
 +===================================================
 +=     matches: 36, mismatches:  0, total: 36      =
 +===================================================
 +lab46:~/src/cprog/mbe0$ 
 +</cli>
 +
 +Since your project submission will be evaluated in part by compliance to output specifications, you probably want to check to see how you are doing before submitting.
 =====Reflection===== =====Reflection=====
 Be sure to provide any commentary on your journal regarding realizations had and discoveries made during your pursuit of this project. Be sure to provide any commentary on your journal regarding realizations had and discoveries made during your pursuit of this project.
Line 325: Line 425:
  
   * Code must compile cleanly (no warnings or errors)   * Code must compile cleanly (no warnings or errors)
 +    * Again, I will be compiling as follows: gcc -Wall -o mbe0 mbe0.c
   * Submit the program in a file called **mbe0.c**   * Submit the program in a file called **mbe0.c**
   * Output must be correct, and match the form given in the sample output above.   * Output must be correct, and match the form given in the sample output above.
haas/spring2017/cprog/projects/mbe0.1486502534.txt.gz · Last modified: 2017/02/07 21:22 by wedge