[cig-commits] r9117 - cs/benchmark/cigma/trunk/src/tests
luis at geodynamics.org
luis at geodynamics.org
Tue Jan 22 19:22:51 PST 2008
Author: luis
Date: 2008-01-22 19:22:51 -0800 (Tue, 22 Jan 2008)
New Revision: 9117
Modified:
cs/benchmark/cigma/trunk/src/tests/TestStringUtils.cpp
Log:
Iterate thru all test strings in TestStringUtils.cpp
Modified: cs/benchmark/cigma/trunk/src/tests/TestStringUtils.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/tests/TestStringUtils.cpp 2008-01-23 03:22:50 UTC (rev 9116)
+++ cs/benchmark/cigma/trunk/src/tests/TestStringUtils.cpp 2008-01-23 03:22:51 UTC (rev 9117)
@@ -1,7 +1,10 @@
#include <iostream>
#include <iomanip>
+#include <vector>
#include "../StringUtils.h"
+using namespace std;
+
int main()
{
// conversion functions
@@ -11,32 +14,46 @@
string_to_int("123456", i);
string_to_double("2.718281828459045", e);
- std::cout << std::setprecision(16);
- std::cout << "i = " << i << std::endl;
- std::cout << "e = " << e << std::endl;
+ cout << setprecision(16);
+ cout << "i = " << i << endl;
+ cout << "e = " << e << endl;
+ cout << endl;
}
// path functions
{
- using namespace std;
- std::string vtkpath = "/path/to/file.vtk:temperature";
- std::string hdfpath = "/path/to/file.h5:/path/to/dataset";
- std::string testpath = "/path/to/some/file.ext:foo:bar:baz";
+ string vtkpath = "/path/to/file.vtk:temperature";
+ string hdfpath = "/path/to/file.h5:/path/to/dataset";
+ string testpath1 = "/path/to/some/file.ext:foo:bar";
+ string testpath2 = "/path/to/file.ext:";
- std::string path, location, filename, ext;
+ vector<string> paths;
+ paths.push_back(vtkpath);
+ paths.push_back(hdfpath);
+ paths.push_back(testpath1);
+ paths.push_back(testpath2);
- path = testpath;
- parse_dataset_path(path, location, filename, ext);
- std::cout << "path = '" << path << "'\n";
- std::cout << "filename = '" << filename << "'\n";
- std::cout << "extension = '" << ext << "'\n";
- std::cout << "location = '" << location << "'\n";
+ string path;
+ string location, filename, ext;
+ string locdir, locbase;
- string locdir, locbase;
- path_dirname(location, locdir);
- path_basename(location, locbase);
- cout << "location dirname = '" << locdir << "'\n";
- cout << "location basename = '" << locbase << "'\n";
+ vector<string>::iterator i;
+ for (i = paths.begin(); i != paths.end(); ++i)
+ {
+ path = *i;
+
+ parse_dataset_path(path, location, filename, ext);
+ cout << "path = '" << path << "'\n";
+ cout << "filename = '" << filename << "'\n";
+ cout << "extension = '" << ext << "'\n";
+ cout << "location = '" << location << "'\n";
+
+ path_dirname(location, locdir);
+ path_basename(location, locbase);
+ cout << "location dirname = '" << locdir << "'\n";
+ cout << "location basename = '" << locbase << "'\n";
+ cout << endl;
+ }
}
return 0;
More information about the cig-commits
mailing list