Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

tests update

  • Loading branch information...
commit cd21b623747b64480815d47d5bdc87bf5457553e 1 parent 95a3656
Seb Noury authored

Showing 2 changed files with 12 additions and 12 deletions. Show diff stats Hide diff stats

  1. +10 10 tests/configtest.cpp
  2. +2 2 tests/configtest2.yaml
20 tests/configtest.cpp
@@ -6,13 +6,13 @@
6 6 #define assert(COND) if(!(COND)) { std::cerr << "Assertion failed (line " << __LINE__ \
7 7 <<"): " << #COND << std::endl; exit(-1); }
8 8
9   -struct float4 { float x, y, z, w; };
10   -struct Player { std::string name; unsigned int life; float4 position; };
  9 +struct float3 { float x, y, z; };
  10 +struct Player { std::string name; unsigned int life; float3 position; };
11 11
12   -void operator>>(const Config::Node &n, float4 &f4)
  12 +void operator>>(const Config::Node &n, float3 &f3)
13 13 {
14   - assert(n.GetTag() == "!float4"); // optional type-check
15   - n[0] >> f4.x; n[1] >> f4.y; n[2] >> f4.z; n[3] >> f4.w;
  14 + assert(n.GetTag() == "!float3"); // optional type-check
  15 + n[0] >> f3.x; n[1] >> f3.y; n[2] >> f3.z;
16 16 }
17 17
18 18 void operator>>(const Config::Node &n, Player &p)
@@ -23,9 +23,9 @@ void operator>>(const Config::Node &n, Player &p)
23 23 n["position"] >> p.position;
24 24 }
25 25
26   -std::ostream &operator<<(std::ostream &s, const float4 &f4)
  26 +std::ostream &operator<<(std::ostream &s, const float3 &f3)
27 27 {
28   - s << "(" << f4.x << ", " << f4.y << ", " << f4.z << ", " << f4.w << ")";
  28 + s << "(" << f3.x << ", " << f3.y << ", " << f3.z << ")";
29 29 }
30 30
31 31 std::ostream &operator<<(std::ostream &s, const Player &p)
@@ -37,7 +37,7 @@ int main(int argc, char **argv)
37 37 {
38 38 std::cout << "#### Test case 1 ####" << std::endl;
39 39 {
40   - std::ifstream f("test/configtest1.yaml");
  40 + std::ifstream f("tests/configtest1.yaml");
41 41 Config cfg(f);
42 42
43 43 unsigned int width = cfg["screen/width"];
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
55 55
56 56 std::cout << "#### Test case 2 ####" << std::endl;
57 57 {
58   - std::ifstream f("test/configtest2.yaml");
  58 + std::ifstream f("tests/configtest2.yaml");
59 59 Config cfg(f);
60 60
61 61 std::vector<Player> players = cfg["players"];
@@ -67,7 +67,7 @@ int main(int argc, char **argv)
67 67
68 68 std::cout << "#### Test case 3 ####" << std::endl;
69 69 {
70   - std::ifstream f("test/configtest3.yaml");
  70 + std::ifstream f("tests/configtest3.yaml");
71 71 Config cfg(f);
72 72
73 73 const Config::Node &techniques = cfg["techniques"];
4 tests/configtest2.yaml
@@ -2,8 +2,8 @@ players:
2 2 - !Player
3 3 name: Player 1
4 4 life: 100
5   - position: !float4 [1.0, 0.0, 0.0, 0.0]
  5 + position: !float3 [1.0, 0.0, 0.0]
6 6 - !Player
7 7 name: Player 2
8 8 life: 80
9   - position: !float4 [0.0, 1.0, 0.0, 0.0]
  9 + position: !float3 [0.0, 1.0, 0.0]

0 comments on commit cd21b62

Please sign in to comment.
Something went wrong with that request. Please try again.