Refactor
Once the functionality of code is known, the code can be tested or changed with understanding. This project will be using the SDL-Devil project.
In this assignment, you will build a test suite to verify that any changes made to a block of code do not break the code. Then, you will refactor the level statistics code in src/do_stat.c
. As you make changes, you will need to test to verify that you have not introduced an incorrect refactor. You will need to create a script to diff your refactor output against the established output stats. Your test script should quickly identify if any errors are in the refactor.
Your goals:
- Create a program to output level stats
- Collect level stats before any other changes
- Design a testing framework to validate your refactor
- Refactor the stats code to a better state
- Always make sure your refactor matches the original stat cases
I provide the fllowing:
- A set of levels to use for tests
- The results of my testing suite, so you can verify yours
The project groups are:
chanck fengy3
clonintl xiey2
calarejf petrisjj
hilliara chenj10
johnsor2 wangy18
mckownqa shenx
mongovsp liur5
proctem graziodj
schluncg neessc
sheffeit paytonzk
wangc6 shaferw
zhengj2 huangf1
Your groups repo is at gitter.csse.rose-hulman.edu:/repos/1819c-490-week3-USERNAME-USERNAME
.
A few notes:
- You must build the project for the x86 architecture (32bit). 64bit builds are not supported.
- There are many levels that fail to load properly. I have split the dataset into the following cases:
- You will need the SDL 1.2 libraries. The project is setup to check the root of the C drive for the libaries and includes.
- The project files are missing from the repo for some reason. Here they are. Extract to the
sdldevil-code
project directory. - Windows will need the
SDL.dll
files in the same directory as the executable in order to run. So, copy the dll fromC:/SDL-1.2.15/lib/x86/
to your build destination (probablyvsproj/Debug/
).
Rubric
Add harness to output stats | 0 : No statistics | 1 : Gets stats for a level |
Test script to compare refactor output | 0 : No script | 1 : Comparison script |
Script quickly indicates failures | 0 : Report at end | 1 : Immediate error abort |
Test flexibiliti | 0 : Hard coded | 1 : Adapts to test data |
Script correctly identifies errors | 0 : Does not find errors | 1 : Correctly finds errors |
Levels of indention | 0 : > 4 levels | 1 : < 5 levels |
Semantic meaning | 0 : No semantic meaning | 1 : All conditions have meaning |
Complexity | 0 : Hard to uunderstand code | 1 : Code is simpler |
Repetition | 0 : Has repetition | 1 : All repeated code abstracted out |
Refactor correctness | 0 : Incorrect | 1 : Correct |