From cd21b623747b64480815d47d5bdc87bf5457553e Mon Sep 17 00:00:00 2001 From: Sebastien Noury Date: Sun, 24 Apr 2011 18:10:56 +0200 Subject: [PATCH] tests update --- tests/configtest.cpp | 20 ++++++++++---------- tests/configtest2.yaml | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/configtest.cpp b/tests/configtest.cpp index 6da019b..2bad542 100644 --- a/tests/configtest.cpp +++ b/tests/configtest.cpp @@ -6,13 +6,13 @@ #define assert(COND) if(!(COND)) { std::cerr << "Assertion failed (line " << __LINE__ \ <<"): " << #COND << std::endl; exit(-1); } -struct float4 { float x, y, z, w; }; -struct Player { std::string name; unsigned int life; float4 position; }; +struct float3 { float x, y, z; }; +struct Player { std::string name; unsigned int life; float3 position; }; -void operator>>(const Config::Node &n, float4 &f4) +void operator>>(const Config::Node &n, float3 &f3) { - assert(n.GetTag() == "!float4"); // optional type-check - n[0] >> f4.x; n[1] >> f4.y; n[2] >> f4.z; n[3] >> f4.w; + assert(n.GetTag() == "!float3"); // optional type-check + n[0] >> f3.x; n[1] >> f3.y; n[2] >> f3.z; } void operator>>(const Config::Node &n, Player &p) @@ -23,9 +23,9 @@ void operator>>(const Config::Node &n, Player &p) n["position"] >> p.position; } -std::ostream &operator<<(std::ostream &s, const float4 &f4) +std::ostream &operator<<(std::ostream &s, const float3 &f3) { - s << "(" << f4.x << ", " << f4.y << ", " << f4.z << ", " << f4.w << ")"; + s << "(" << f3.x << ", " << f3.y << ", " << f3.z << ")"; } std::ostream &operator<<(std::ostream &s, const Player &p) @@ -37,7 +37,7 @@ int main(int argc, char **argv) { std::cout << "#### Test case 1 ####" << std::endl; { - std::ifstream f("test/configtest1.yaml"); + std::ifstream f("tests/configtest1.yaml"); Config cfg(f); unsigned int width = cfg["screen/width"]; @@ -55,7 +55,7 @@ int main(int argc, char **argv) std::cout << "#### Test case 2 ####" << std::endl; { - std::ifstream f("test/configtest2.yaml"); + std::ifstream f("tests/configtest2.yaml"); Config cfg(f); std::vector players = cfg["players"]; @@ -67,7 +67,7 @@ int main(int argc, char **argv) std::cout << "#### Test case 3 ####" << std::endl; { - std::ifstream f("test/configtest3.yaml"); + std::ifstream f("tests/configtest3.yaml"); Config cfg(f); const Config::Node &techniques = cfg["techniques"]; diff --git a/tests/configtest2.yaml b/tests/configtest2.yaml index 97b3be7..40130d7 100644 --- a/tests/configtest2.yaml +++ b/tests/configtest2.yaml @@ -2,8 +2,8 @@ players: - !Player name: Player 1 life: 100 - position: !float4 [1.0, 0.0, 0.0, 0.0] + position: !float3 [1.0, 0.0, 0.0] - !Player name: Player 2 life: 80 - position: !float4 [0.0, 1.0, 0.0, 0.0] + position: !float3 [0.0, 1.0, 0.0]