"vscode:/vscode.git/clone" did not exist on "614b92c065f243df88998a8ad5a2b0ff8af81fac"
Commit adc0e7e7 authored by beder's avatar beder
Browse files

Tweaked node iterator tests

parent bd9103f4
...@@ -332,18 +332,24 @@ namespace Test ...@@ -332,18 +332,24 @@ namespace Test
int seq[] = {1, 3, 5, 7}; int seq[] = {1, 3, 5, 7};
int i=0; int i=0;
for(YAML::const_iterator it=node.begin();it!=node.end();++it) { for(YAML::const_iterator it=node.begin();it!=node.end();++it) {
YAML_ASSERT(i < 4);
int x = seq[i++]; int x = seq[i++];
YAML_ASSERT(it->as<int>() == x); YAML_ASSERT(it->as<int>() == x);
} }
YAML_ASSERT(i == 4);
return true; return true;
} }
TEST IterateMap() TEST IterateMap()
{ {
YAML::Node node = YAML::Load("{a: A, b: B, c: C}"); YAML::Node node = YAML::Load("{a: A, b: B, c: C}");
int i=0;
for(YAML::const_iterator it=node.begin();it!=node.end();++it) { for(YAML::const_iterator it=node.begin();it!=node.end();++it) {
YAML_ASSERT(i < 3);
i++;
YAML_ASSERT(it->first.as<char>() + 'A' - 'a' == it->second.as<char>()); YAML_ASSERT(it->first.as<char>() + 'A' - 'a' == it->second.as<char>());
} }
YAML_ASSERT(i == 3);
return true; return true;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment