Skip to content
Snippets Groups Projects
Commit 1a34ec49 authored by Christian Engwer's avatar Christian Engwer
Browse files

- test the array & vector parser

- make sure they can handle all knds of white spaces

[[Imported from SVN: r6287]]
parent 8e498c7e
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,23 @@ void testparam(const P & p)
std::cout << p.template get<double>("x1") << std::endl;
std::cout << p.template get<std::string>("x2") << std::endl;
std::cout << p.template get<bool>("x3") << std::endl;
// try reading array like structures
std::vector<unsigned int>
array1 = p.template get< std::vector<unsigned int> >("array");
Dune::array<unsigned int, 8>
array2 = p.template get< Dune::array<unsigned int, 8> >("array");
Dune::FieldVector<unsigned int, 8>
array3 = p.template get< Dune::FieldVector<unsigned int, 8> >("array");
assert(array1.size() == 8);
std::cout << "array =";
for (unsigned int i=0; i<8; i++)
{
assert(array1[i] == i+1);
assert(array2[i] == i+1);
assert(array3[i] == i+1);
std::cout << "\t" << array1[i];
}
std::cout << std::endl;
// try accessing subtree
p.sub("Foo");
p.sub("Foo").template get<std::string>("peng");
......@@ -91,6 +108,7 @@ int main()
s << "x1 = 1 # comment\n"
<< "x2 = hallo\n"
<< "x3 = no\n"
<< "array = 1 2 3 4 5\t6 7 8\n"
<< "\n"
<< "[Foo]\n"
<< "peng = ligapokal\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment