branch: devel-tetsuo-xml
commit bd73e11abecd4e1f373218cb7e424f2873e4b784
Author: Tetsuo Koyama <[email protected]>
AuthorDate: Sun Apr 26 09:04:09 2020 +0000

    :test_tube: vtu_export parse
---
 tests/test_export.cc | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/test_export.cc b/tests/test_export.cc
index 1d71533..7cacfee 100644
--- a/tests/test_export.cc
+++ b/tests/test_export.cc
@@ -18,10 +18,17 @@
  Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
 
 ===========================================================================*/
+#include <iostream>
+#include <string>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lexical_cast.hpp>
 #include "getfem/getfem_regular_meshes.h"
 #include "getfem/getfem_export.h"
 
 using bgeot::base_node;
+using namespace boost::property_tree;
 
 int main(void) {
 
@@ -48,6 +55,15 @@ int main(void) {
   vtu_exp.exporting(m0);
   vtu_exp.write_mesh();
 
+  ptree pt;
+  read_xml("m0.vtu", pt);
+
+  if (boost::optional<std::string> str = 
pt.get_optional<std::string>("VTKFile.<xmlattr>.type")) {
+    GMM_ASSERT1(str.get() == "UnstructuredGrid", "UnstructuredGrid attribute 
is not incorrect.");
+  } else {
+    GMM_ASSERT1(false, "UnstructuredGrid attribute is not exist.");
+  }
+
   return 0;
 }
 

Reply via email to