From: abn Date: Wed, 2 Dec 2015 10:47:48 +0000 (+0100) Subject: Fixing JSON reader tests, my bad. X-Git-Tag: simple_cmake~2^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9db0e3505f2552da93f2b12d7a5eb4d15253e1b2;p=modules%2Fparavis.git Fixing JSON reader tests, my bad. --- diff --git a/src/Plugins/JSONReader/Test/BadFiles/bad_ex8.json b/src/Plugins/JSONReader/Test/BadFiles/bad_ex8.json index f1c0f85f..7e1258bb 100644 --- a/src/Plugins/JSONReader/Test/BadFiles/bad_ex8.json +++ b/src/Plugins/JSONReader/Test/BadFiles/bad_ex8.json @@ -14,7 +14,7 @@ { "P":3.15, "u": 0.0, - "weight": "43.5" + "weight": "43.5" "43.5" }, { diff --git a/src/Plugins/JSONReader/Test/MainTest.hxx b/src/Plugins/JSONReader/Test/MainTest.hxx index 7e085704..b8959e96 100644 --- a/src/Plugins/JSONReader/Test/MainTest.hxx +++ b/src/Plugins/JSONReader/Test/MainTest.hxx @@ -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(); diff --git a/src/Plugins/JSONReader/Test/vtkJSONParserTest.cxx b/src/Plugins/JSONReader/Test/vtkJSONParserTest.cxx index 256461f2..d8224e86 100644 --- a/src/Plugins/JSONReader/Test/vtkJSONParserTest.cxx +++ b/src/Plugins/JSONReader/Test/vtkJSONParserTest.cxx @@ -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();