64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
/*
|
|
* =====================================================================================
|
|
*
|
|
* Filename: catch.cpp
|
|
*
|
|
* Description: Unit Tests for EntityConverter
|
|
*
|
|
* Version: 0.1
|
|
* Created: 07/03/2017 08:25:04 PM
|
|
* Revision: none
|
|
* Compiler: gcc
|
|
*
|
|
* Author: suhrke@teknik.io
|
|
*
|
|
* =====================================================================================
|
|
*/
|
|
|
|
#ifndef CATCH_CONFIG_MAIN
|
|
#define CATCH_CONFIG_MAIN
|
|
#include "catch.hpp"
|
|
#include <queue>
|
|
#include <vector>
|
|
|
|
#include "EntityConverter.hpp"
|
|
|
|
#define PICKUP_FILENAME "r2x.pck"
|
|
|
|
|
|
|
|
TEST_CASE( "r2x: a single pickup entity can be converted", "[EntityConverter]" ) {
|
|
|
|
// Instantiate object
|
|
EntityConverter ec (PICKUP_FILENAME);
|
|
|
|
// Mock up entity
|
|
std::vector<std::string> entity;
|
|
entity.push_back(" type Pickup");
|
|
entity.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
|
entity.push_back(" Vector3 angles 180.00000 0.00000 0.00000");
|
|
entity.push_back(" UInt8 pickupType 2");
|
|
|
|
// Mock up entity queue
|
|
std::queue<std::vector<std::string>> q;
|
|
|
|
// Match related entities (none)
|
|
ec.matchRelated( q );
|
|
|
|
// (only a single pickup entity)
|
|
std::vector<std::string> converted = ec.convert(entity);
|
|
|
|
REQUIRE( converted[0] == "\"classname\" \"weapon_grenadelauncher\"\n" );
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //CATCH_CONFIG_MAIN
|