Rally X
ELEN3009 Project by Justin Wernick and David Schneider
Functions
tests/dataTests.cpp File Reference

Unit tests for the data layer of a Rally-X game. More...

#include <cstdio>
#include <fstream>
#include <gtest/gtest.h>
#include "../source/data/Config.h"
#include "../source/data/LevelReader.h"
#include "../source/logic/PlayerCar.h"
#include "../source/logic/EnemyCar.h"
#include "../source/logic/Checkpoint.h"
#include "../source/logic/Rock.h"
#include "../source/logic/Smokescreen.h"
#include "../source/logic/Maze.h"

Go to the source code of this file.

Functions

 TEST (Config, readsSettingsCorrectly)
 Tests that a normal complete config file can be read.
 TEST (Config, createsFileIfNeeded)
 Tests that, if the config file does not exist, it is created with default values.
 TEST (Config, incompleteFileFilled)
 Tests that an incomplete config file is loaded, with defaults for the missing values.
 TEST (LevelReader, readsFileInfoObjects)
 Tests that a level can be loaded correctly from a file.
 TEST (LevelReader, throwsExceptionOnBadFilename)
 Tests that an exception is throws if the selected file does not exist.

Detailed Description

Unit tests for the data layer of a Rally-X game.

The functionality of each class in the data layer was tested.

The Config class was tested in terms of its ability to read an existing config file, as well as its ability to create a new file with default values, or fill missing parameters with default values.

The LevelReader class was tested in the normal case, where a correct level file is given, and in the case where a file that does not exist is given.

Author:
Justin Wernick
David Schneider

Definition in file dataTests.cpp.


Function Documentation

TEST ( Config  ,
readsSettingsCorrectly   
)

Tests that a normal complete config file can be read.

Definition at line 35 of file dataTests.cpp.

TEST ( Config  ,
createsFileIfNeeded   
)

Tests that, if the config file does not exist, it is created with default values.

Definition at line 58 of file dataTests.cpp.

TEST ( Config  ,
incompleteFileFilled   
)

Tests that an incomplete config file is loaded, with defaults for the missing values.

Definition at line 78 of file dataTests.cpp.

TEST ( LevelReader  ,
readsFileInfoObjects   
)

Tests that a level can be loaded correctly from a file.

Definition at line 99 of file dataTests.cpp.

TEST ( LevelReader  ,
throwsExceptionOnBadFilename   
)

Tests that an exception is throws if the selected file does not exist.

Definition at line 174 of file dataTests.cpp.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator