[cig-commits] r8933 - cs/benchmark/cigma/trunk/src/tests
luis at geodynamics.org
luis at geodynamics.org
Wed Dec 19 12:05:01 PST 2007
Author: luis
Date: 2007-12-19 12:05:00 -0800 (Wed, 19 Dec 2007)
New Revision: 8933
Added:
cs/benchmark/cigma/trunk/src/tests/TestStringUtils.cpp
Log:
Testing the functions in StringUtils.h
Added: cs/benchmark/cigma/trunk/src/tests/TestStringUtils.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/tests/TestStringUtils.cpp 2007-12-19 20:04:52 UTC (rev 8932)
+++ cs/benchmark/cigma/trunk/src/tests/TestStringUtils.cpp 2007-12-19 20:05:00 UTC (rev 8933)
@@ -0,0 +1,40 @@
+#include <iostream>
+#include <iomanip>
+#include "../StringUtils.h"
+
+int main()
+{
+ // conversion functions
+ {
+ int i;
+ double e;
+ 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;
+ }
+
+ // 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 location, filename, ext;
+
+ parse_dataset_path(hdfpath, location, filename, ext);
+ std::cout << "path = '" << hdfpath << "'\n";
+ std::cout << "filename = '" << filename << "'\n";
+ std::cout << "extension = '" << ext << "'\n";
+ std::cout << "location = '" << location << "'\n";
+
+ string locdir, locbase;
+ path_dirname(location, locdir);
+ path_basename(location, locbase);
+ cout << "location dirname = '" << locdir << "'\n";
+ cout << "location basename = '" << locbase << "'\n";
+ }
+
+ return 0;
+}
More information about the cig-commits
mailing list