]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Fixing JSON reader tests, my bad.
authorabn <adrien.bruneton@cea.fr>
Wed, 2 Dec 2015 10:47:48 +0000 (11:47 +0100)
committerabn <adrien.bruneton@cea.fr>
Wed, 2 Dec 2015 10:47:48 +0000 (11:47 +0100)
src/Plugins/JSONReader/Test/BadFiles/bad_ex8.json
src/Plugins/JSONReader/Test/MainTest.hxx
src/Plugins/JSONReader/Test/vtkJSONParserTest.cxx

index f1c0f85f7491cf083739f41d259ea9f8520e1670..7e1258bb4d709f9a399a5b6099f9ef9d372b4e20 100644 (file)
@@ -14,7 +14,7 @@
       {
         "P":3.15,
         "u": 0.0,
-        "weight": "43.5"
+        "weight": "43.5" "43.5"
       },
       
       {
index 7e08570428e335c61b9ca682ce883c1616256903..b8959e964e13e9482e77f20a9aa182b28828b5a1 100644 (file)
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
 
   std::ofstream testFile;
   testFile.open("UnitTestsResult.txt", std::ios::out |  std::ios::trunc);
-  //CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
+//  CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
   CPPUNIT_NS::CompilerOutputter outputter( &result, testFile );
   outputter.write(); 
 
index 256461f2ac8caba3170c1de14b9971fa72c3116b..d8224e86aea057ea03f57c38af75709e270cb5e8 100644 (file)
@@ -75,16 +75,17 @@ void vtkJSONParserTest::testParseBadFiles() {
     vtkTable* table = vtkTable::New();
     Parser->SetFileName(s.c_str());
     bool expected_exception_thrown = false;
-    try{
-      Parser->Parse(table);
-    } catch(vtkJSONException e) {
-      expected_exception_thrown = true;
-    }
+    CPPUNIT_ASSERT_THROW(Parser->Parse(table), vtkJSONException);
+//    try{
+//      ;
+//    } catch(vtkJSONException e) {
+//      expected_exception_thrown = true;
+//    }
     Parser->Delete();
     table->Delete();
-    if(!expected_exception_thrown) {
-      CPPUNIT_FAIL("Expected exception is not thrown !!! ");
-    }
+//    if(!expected_exception_thrown) {
+//      CPPUNIT_FAIL("Expected exception is not thrown !!! ");
+//    }
   }
 }
 
@@ -104,18 +105,18 @@ void vtkJSONParserTest::testParseGoodFiles() {
     vtkJSONParser* Parser = vtkJSONParser::New();
     vtkTable* table = vtkTable::New();
     Parser->SetFileName(s.c_str());
-    bool exception_thrown = false;
-    try{
+//    bool exception_thrown = false;
+//    try{
       Parser->Parse(table);
-    } catch(vtkJSONException e) {
-      exception_thrown = true;
-    }
+//    } catch(vtkJSONException e) {
+//      exception_thrown = true;
+//    }
     Parser->Delete();
     table->Delete();
     
-    if(exception_thrown) {
-      CPPUNIT_FAIL("Unexpected exception has been thrown !!! ");
-    }
+//    if(exception_thrown) {
+//      CPPUNIT_FAIL("Unexpected exception has been thrown !!! ");
+//    }
   }
 
   vtkJSONParser* Parser = vtkJSONParser::New();
@@ -128,14 +129,14 @@ void vtkJSONParserTest::testParseGoodFiles() {
   s += "_wo_metadata.json";
   Parser->SetFileName(s.c_str());
   bool exception_thrown = false;
-  try{
+//  try{
     Parser->Parse(table);
-  } catch(vtkJSONException e) {
-    exception_thrown = true;      
-  }    
-  if(exception_thrown) {
-    CPPUNIT_FAIL("Unexpected exception has been thrown !!! ");
-  }
+//  } catch(vtkJSONException e) {
+//    exception_thrown = true;
+//  }
+//  if(exception_thrown) {
+//    CPPUNIT_FAIL("Unexpected exception has been thrown !!! ");
+//  }
 
   double v = table->GetValue(2,0).ToDouble();
   double v1 = table->GetValue(2,1).ToDouble();