diff --git a/ReflexToQ3/test/catch.cpp b/ReflexToQ3/test/catch.cpp index 7ad9bef..5bad903 100644 --- a/ReflexToQ3/test/catch.cpp +++ b/ReflexToQ3/test/catch.cpp @@ -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 entity; + entity.push_back(" type Worldspawn"); + + // Mock up entity queue + std::queue> q; + q.push( entity ); + + // Match related entities (none) + ec.matchRelated( q ); + + // Convert a single entity + std::vector converted = ec.convert(entity); + + REQUIRE( converted.size() == 0 ); +} + + + TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" ) { // Instantiate object @@ -34,10 +58,10 @@ TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" ) // Mock up entity std::vector 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"); + 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> q; @@ -62,11 +86,11 @@ TEST_CASE( "r2x: a single PlayerSpawn (teamA) entity can be converted", "[Entity // Mock up entity std::vector entity; - entity.push_back(" type PlayerSpawn"); - 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(" Bool8 teamB 0"); - entity.push_back(" Bool8 modeRace 0"); + entity.push_back(" type PlayerSpawn"); + 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(" Bool8 teamB 0"); + entity.push_back(" Bool8 modeRace 0"); // Mock up entity queue std::queue> q; @@ -92,7 +116,7 @@ TEST_CASE( "r2x: a single RaceStart entity can be converted", "[EntityConverter] // Mock up entity std::vector entity; - entity.push_back(" type RaceStart"); + entity.push_back(" type RaceStart"); // Mock up entity queue std::queue> q; @@ -118,7 +142,7 @@ TEST_CASE( "r2x: a single RaceFinish entity can be converted", "[EntityConverter // Mock up entity std::vector entity; - entity.push_back(" type RaceFinish"); + entity.push_back(" type RaceFinish"); // Mock up entity queue std::queue> q; @@ -144,14 +168,14 @@ TEST_CASE( "r2x: a single Teleporter and related Target can be converted", "[Ent // Mock up Teleporter entity std::vector entity; - entity.push_back(" type Teleporter"); - entity.push_back(" String32 target tp1"); + entity.push_back(" type Teleporter"); + entity.push_back(" String32 target tp1"); // Mock up Target entity std::vector entity2; - entity2.push_back(" type Target"); - entity2.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488"); - entity2.push_back(" String32 name tp1"); + entity2.push_back(" type Target"); + entity2.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488"); + entity2.push_back(" String32 name tp1"); // Mock up entity queue std::queue> q; @@ -181,14 +205,14 @@ TEST_CASE( "r2x: a single JumpPad and related Target can be converted", "[Entity // Mock up JumpPad entity std::vector entity; - entity.push_back(" type JumpPad"); - entity.push_back(" String32 target jp1"); + entity.push_back(" type JumpPad"); + entity.push_back(" String32 target jp1"); // Mock up Target entity std::vector entity2; - entity2.push_back(" type Target"); - entity2.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488"); - entity2.push_back(" String32 name jp1"); + entity2.push_back(" type Target"); + entity2.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488"); + entity2.push_back(" String32 name jp1"); // Mock up entity queue std::queue> q;