added unsupported entity case to EC unit tests
This commit is contained in:
parent
d47b0af646
commit
dcf6e76f39
@ -27,6 +27,30 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CASE( "r2x: Unsupported entity types cause return of empty vector", "[EntityConverter]" ) {
|
||||||
|
|
||||||
|
// Instantiate object
|
||||||
|
EntityConverter ec (PICKUP_FILENAME);
|
||||||
|
|
||||||
|
// Mock up entity
|
||||||
|
std::vector<std::string> entity;
|
||||||
|
entity.push_back(" type Worldspawn");
|
||||||
|
|
||||||
|
// Mock up entity queue
|
||||||
|
std::queue<std::vector<std::string>> q;
|
||||||
|
q.push( entity );
|
||||||
|
|
||||||
|
// Match related entities (none)
|
||||||
|
ec.matchRelated( q );
|
||||||
|
|
||||||
|
// Convert a single entity
|
||||||
|
std::vector<std::string> converted = ec.convert(entity);
|
||||||
|
|
||||||
|
REQUIRE( converted.size() == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" ) {
|
TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" ) {
|
||||||
|
|
||||||
// Instantiate object
|
// Instantiate object
|
||||||
@ -34,10 +58,10 @@ TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" )
|
|||||||
|
|
||||||
// Mock up entity
|
// Mock up entity
|
||||||
std::vector<std::string> entity;
|
std::vector<std::string> entity;
|
||||||
entity.push_back(" type Pickup");
|
entity.push_back(" type Pickup");
|
||||||
entity.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
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(" Vector3 angles 180.00000 0.00000 0.00000");
|
||||||
entity.push_back(" UInt8 pickupType 2");
|
entity.push_back(" UInt8 pickupType 2");
|
||||||
|
|
||||||
// Mock up entity queue
|
// Mock up entity queue
|
||||||
std::queue<std::vector<std::string>> q;
|
std::queue<std::vector<std::string>> q;
|
||||||
@ -62,11 +86,11 @@ TEST_CASE( "r2x: a single PlayerSpawn (teamA) entity can be converted", "[Entity
|
|||||||
|
|
||||||
// Mock up entity
|
// Mock up entity
|
||||||
std::vector<std::string> entity;
|
std::vector<std::string> entity;
|
||||||
entity.push_back(" type PlayerSpawn");
|
entity.push_back(" type PlayerSpawn");
|
||||||
entity.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
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(" Vector3 angles 180.00000 0.00000 0.00000");
|
||||||
entity.push_back(" Bool8 teamB 0");
|
entity.push_back(" Bool8 teamB 0");
|
||||||
entity.push_back(" Bool8 modeRace 0");
|
entity.push_back(" Bool8 modeRace 0");
|
||||||
|
|
||||||
// Mock up entity queue
|
// Mock up entity queue
|
||||||
std::queue<std::vector<std::string>> q;
|
std::queue<std::vector<std::string>> q;
|
||||||
@ -92,7 +116,7 @@ TEST_CASE( "r2x: a single RaceStart entity can be converted", "[EntityConverter]
|
|||||||
|
|
||||||
// Mock up entity
|
// Mock up entity
|
||||||
std::vector<std::string> entity;
|
std::vector<std::string> entity;
|
||||||
entity.push_back(" type RaceStart");
|
entity.push_back(" type RaceStart");
|
||||||
|
|
||||||
// Mock up entity queue
|
// Mock up entity queue
|
||||||
std::queue<std::vector<std::string>> q;
|
std::queue<std::vector<std::string>> q;
|
||||||
@ -118,7 +142,7 @@ TEST_CASE( "r2x: a single RaceFinish entity can be converted", "[EntityConverter
|
|||||||
|
|
||||||
// Mock up entity
|
// Mock up entity
|
||||||
std::vector<std::string> entity;
|
std::vector<std::string> entity;
|
||||||
entity.push_back(" type RaceFinish");
|
entity.push_back(" type RaceFinish");
|
||||||
|
|
||||||
// Mock up entity queue
|
// Mock up entity queue
|
||||||
std::queue<std::vector<std::string>> q;
|
std::queue<std::vector<std::string>> q;
|
||||||
@ -144,14 +168,14 @@ TEST_CASE( "r2x: a single Teleporter and related Target can be converted", "[Ent
|
|||||||
|
|
||||||
// Mock up Teleporter entity
|
// Mock up Teleporter entity
|
||||||
std::vector<std::string> entity;
|
std::vector<std::string> entity;
|
||||||
entity.push_back(" type Teleporter");
|
entity.push_back(" type Teleporter");
|
||||||
entity.push_back(" String32 target tp1");
|
entity.push_back(" String32 target tp1");
|
||||||
|
|
||||||
// Mock up Target entity
|
// Mock up Target entity
|
||||||
std::vector<std::string> entity2;
|
std::vector<std::string> entity2;
|
||||||
entity2.push_back(" type Target");
|
entity2.push_back(" type Target");
|
||||||
entity2.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
entity2.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
||||||
entity2.push_back(" String32 name tp1");
|
entity2.push_back(" String32 name tp1");
|
||||||
|
|
||||||
// Mock up entity queue
|
// Mock up entity queue
|
||||||
std::queue<std::vector<std::string>> q;
|
std::queue<std::vector<std::string>> q;
|
||||||
@ -181,14 +205,14 @@ TEST_CASE( "r2x: a single JumpPad and related Target can be converted", "[Entity
|
|||||||
|
|
||||||
// Mock up JumpPad entity
|
// Mock up JumpPad entity
|
||||||
std::vector<std::string> entity;
|
std::vector<std::string> entity;
|
||||||
entity.push_back(" type JumpPad");
|
entity.push_back(" type JumpPad");
|
||||||
entity.push_back(" String32 target jp1");
|
entity.push_back(" String32 target jp1");
|
||||||
|
|
||||||
// Mock up Target entity
|
// Mock up Target entity
|
||||||
std::vector<std::string> entity2;
|
std::vector<std::string> entity2;
|
||||||
entity2.push_back(" type Target");
|
entity2.push_back(" type Target");
|
||||||
entity2.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
entity2.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
||||||
entity2.push_back(" String32 name jp1");
|
entity2.push_back(" String32 name jp1");
|
||||||
|
|
||||||
// Mock up entity queue
|
// Mock up entity queue
|
||||||
std::queue<std::vector<std::string>> q;
|
std::queue<std::vector<std::string>> q;
|
||||||
|
Loading…
Reference in New Issue
Block a user