Check the Assignment 3 grade on the ZINC Online Submission System.
There are 99 GTest test cases in total, with each test case having its own grade. The grade stated by ZINC will be 1 if you passed the test case, 0 if you failed, and is NOT indicative of your actual grade.
Please calculate your actual grade by checking the Grading Scheme section. No partial credit is possible within a single test case, as they are not worth more than 2% each.
The two Standard I/O Tests check for Memory and Undefined Behavior errors, and are worth 7% and 3% respectively, also with no partial credit possible.
No partial credit within a test case.
| GameEngineTest | Grade |
|---|---|
IsGameOverTwoPlayers |
2% |
IsGameOverOnePlayer |
2% |
IsGameOverZeroPlayers |
1% |
| Subtotal | 5% |
| GameMapTest | Grade |
|---|---|
UpdateTerrainMapEmptyToOccupied |
1% |
UpdateTerrainMapOccupiedToEmpty |
1% |
IsValidPath |
1% |
IsValidPathOutOfBounds |
1% |
IsValidPathTerrainBlocked |
1% |
IsValidPathTerrainOccupied |
1% |
IsValidPathOutOfMovementRange |
1% |
| Subtotal | 7% |
| PlayerTest | Grade |
|---|---|
GetUnitById |
2% |
HasUnitsAlive |
1% |
HasNoUnitsAlive |
1% |
HasUnitsReady |
1% |
HasNoUnitsReady |
1% |
ReadyAllUnits |
2% |
GetName |
1% |
GetNumUnits |
1% |
GetUnits |
1% |
| Subtotal | 11% |
| UnitTest | Grade |
|---|---|
BeginTurn |
1% |
EndTurn |
1% |
MoveDeltaPositiveRowPositiveCol |
0.5% |
MoveDeltaNegativeRowNegativeCol |
0.5% |
MoveDeltaPositiveRowNegativeCol |
0.5% |
MoveDeltaNegativeRowPositiveCol |
0.5% |
HealRate |
1% |
HealMaxHealth |
1% |
GetId |
1% |
GetUnitType |
1% |
GetAttackRange |
1% |
GetMovementRange |
1% |
GetPositionRow |
1% |
GetPositionCol |
1% |
IsReadyTrue |
0.5% |
IsReadyFalse |
0.5% |
IsAliveNonzeroHealth |
0.5% |
IsAliveZeroHealth |
0.5% |
| Subtotal | 14% |
| DerivedUnitTest (Duplicated for all 4 Derived Unit Classes) | Grade |
|---|---|
ConstructorId |
0.5% |
ConstructorUnitType |
0.5% |
ConstructorHealth |
0.5% |
ConstructorAttack |
0.5% |
ConstructorDefense |
0.5% |
ConstructorAttackRange |
0.5% |
ConstructorMovementRange |
0.5% |
ConstructorPositionRow |
0.5% |
ConstructorPositionCol |
0.5% |
ToString |
1% |
AttackSwordsman |
1.5% |
AttackPikeman |
1.5% |
AttackKnight |
1.5% |
AttackArcher |
1.5% |
SimultaneousCounterattack |
1.5% |
| Subtotal | 13% x4 |
| ArcherTest | Grade |
|---|---|
RangedAttackAgainstMelee |
0.5% |
RangedAttackAgainstArcher |
0.5% |
| Subtotal | 1% |
| Standard I/O Test | Grade |
|---|---|
Test #1 (Memory & Address) |
7% |
Test #2 (Undefined Behavior) |
3% |
| Subtotal | 10% |
pa3_gtest_windows.zip into any convenient folder.
UnitDerivedGTest.hPA3_GTest.cpp.\include\gtest\ (various subdirectories and files).\lib\libgtest.a.\lib\libgtest_main.ag++ commands:
g++ -std=c++11 -pedantic -Wall -Wextra -g -O0 -c GameEngine.cpp -o GameEngine.og++ -std=c++11 -pedantic -Wall -Wextra -g -O0 -c GameMap.cpp -o GameMap.og++ -std=c++11 -pedantic -Wall -Wextra -g -O0 -c Player.cpp -o Player.og++ -std=c++11 -pedantic -Wall -Wextra -g -O0 -c Unit.cpp -o Unit.og++ -std=c++11 -pedantic -Wall -Wextra -g -O0 -c Swordsman.cpp -o Swordsman.og++ -std=c++11 -pedantic -Wall -Wextra -g -O0 -c Pikeman.cpp -o Pikeman.og++ -std=c++11 -pedantic -Wall -Wextra -g -O0 -c Knight.cpp -o Knight.og++ -std=c++11 -pedantic -Wall -Wextra -g -O0 -c Archer.cpp -o Archer.og++ -std=c++11 -pedantic -Wall -Wextra -g -O0 "-I.\\include" -c PA3_GTest.cpp -o PA3_GTest.og++ "-L.\\lib" -o PA3_GTest.exe GameEngine.o GameMap.o Player.o Unit.o Swordsman.o Pikeman.o Knight.o Archer.o PA3_GTest.o -lgtest -lgtest_main"-IC:\\Desktop\\convenient_folder\\include" , "-LC:\\Desktop\\convenient_folder\\lib") if relative pathnames fail to parse.gtest-*.h during Step 3, try replacing -std=c++11 with -std=c++0x, -std=gnu++0x, or -std=gnu++11.PA3_GTest.exe. Note that there is no pause after output, so the terminal may close automatically.
To configure googletest for other platforms, please refer to the googletest make documentation.
You'll need to compile the googletest library files libgtest.a and libgtest_main.a specifically for your platform.
The Memory and Undefined Behavior checks are performed with the compiler itself by adding the "-fsanitize=address" and "-fsanitize=undefined" compiler flags with GNU g++ on Linux.
However, these flags are not available for MinGW on Windows.
Nevertheless, the memory management code that you need to complete is just only in the Player Destructor - call delete on each Unit* in units array, and call delete[] on units.