Project 1 is due 8/29/16 on or before 11:59:59pm MST.
Part 1 (10 points)
Sign up for the course mailing list. Please provide your ASURITE ID number when you register so that we can give you credit for signing up.
Part 2 (45 points)
The goal of this project is to get your CSE 340 assignment enviornment installed and configured. This will save you many hours of grief in the future.
You need to install CentOS 7 on a virtual machine. Read the document CSE340F16_CentOS_Guide.pdf carefully and follow the instructions in that guide to install CentOS 7 on a virtual machine.
If you don’t have a system to do this, you can use the computers in the Brickyard 214 lab.
Register for the course submission website at: https://cse340.fulton.asu.edu/cse340/
You should use this website to submit all programming assignments in this course. If you run into problems using this website, send an email to our amazing TA Mohsen Zohrevandi email@example.com.
After finishing part 2.1, download
secret_32bit.o) depending on the installed CentOS 7 architecture. Then, copy the
following code in a new text file and change the number on line 5 to match
your ASU Id:
1 2 3 4 5 6 7
Save this file with name
project1.c in the same folder as
Then open a terminal window to compile and link the program with the following
gcc secret_64bit.o project1.c
If running on a 32-bit architecture, use
secret_32bit.o instead of
If all goes well, you should have an executable file named
a.out. Execute it
with the following command:
./a.out > p1_output.txt
Submit the resulting file
p1_output.txt in the course submission website.
Part 3 (45 points)
A key element of success in the course projects is to create additional test cases beyond what we provide you. Thinking about how to properly test your code and create test cases is a valuable skill that will benefit your future career.
The goal of this project is to get familiar with creating test cases that exercise all code in a program. A side benefit of this project is practicing reading other people’s code, which you will do significantly throughout your career.
On the submission site you will find
You need to write a test suite that achieves 100% code coverage of
Code Coverage is a measurement that describes how much of a program is exercised by a test suite. A test suite with high code coverage will increase the assurance that the program meets the specification, while a test suite with low code coverage does not properly exercise all of the program’s functionality.
We will use the program
gcov to measure the code coverage of your
test suite. It is imperative that you use
gcov to test the code
coverage of your test suite before you submit.
To measure the code coverage of your test suite using
gcov, you must
program.c with special GCC flags (note that only
-ftest-coverage are required, however
which displays all warnings, is an excellent habit to create and
continue in the rest of the course):
gcc -Wall -fprofile-arcs -ftest-coverage program.c
After running this command,
gcc will create an executable file
a.out in the current directory. Now, every time
a.out is executed,
the code coverage will be measured.
Say we have two test cases in our test suite,
both in the
test_cases directory. We can then run the test cases
a.out like so:
./a.out < test_cases/test_1 ./a.out < test_cases/test_2
Now, we can generate the code coverage percentage with
It is important that you run
gcov in the same directory that you
The code coverage score that
gcov reports will be your score on this
part of the assignment.
gcov will also generate a file
program.c.gcov, and this file contains valuable information about
the lines of code in
program.c that your test suite executed (as
well as how many times it was executed).
The evaluation system is running the same OS that you set up in part
2, so you must use this when running
Your submission for this part of the project is the test suite. You
must submit a file called
test_cases.tar.gz, and that file must
contain a directory called
test_cases will all the test cases inside
(it does not matter what you call the test cases).
test_cases.tar.gz can be created by the following command (run in
the same directory that contains
tar -czvf test_cases.tar.gz test_cases
test_cases.tar.gz to the
online submission system for immediate evaluation
There are many different measurements for code coverage, and we are using statement coverage in this project. Some are coarse-grained, such as function/method coverage. Others are more fine-grained, such as branch coverage or condition coverage. If you want to expand your knowledge, study the differences between these, and challenge yourself to achieve 100% branch coverage in this project.
Part 2 of this project description was created by Mohsen Zohrevandi, and is used with permission.