]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
automatic test for DTM, refs issue #1066
authorasl <asl@opencascade.com>
Fri, 9 Dec 2016 09:22:59 +0000 (12:22 +0300)
committerasl <asl@opencascade.com>
Fri, 9 Dec 2016 09:22:59 +0000 (12:22 +0300)
src/HYDRO_tests/reference_data/CMakeLists.txt
src/HYDRO_tests/reference_data/pb_1066.cbf [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_DTM.cxx
src/HYDRO_tests/test_HYDROData_DTM.h

index b3fb11246134e1046275a581876fa4312d45c452..2ee55128609ba7fc312740228c38edc5bdc01a2d 100644 (file)
@@ -116,6 +116,7 @@ SET(REFERENCE_DATA
     DTM_2.png
     stream_dtm_2d.png
     stream_dtm_3d.png
+    pb_1066.cbf
 )
 
 # Application tests
diff --git a/src/HYDRO_tests/reference_data/pb_1066.cbf b/src/HYDRO_tests/reference_data/pb_1066.cbf
new file mode 100644 (file)
index 0000000..220d577
Binary files /dev/null and b/src/HYDRO_tests/reference_data/pb_1066.cbf differ
index 3cf271fdca1f4a9a43ae56ec6f9f1c70e55d78a8..c9934653c6cc5a1d3af64f02cf33d60b13b08d0c 100644 (file)
@@ -21,6 +21,7 @@
 #include <HYDROData_Profile.h>
 #include <HYDROData_DTM.h>
 #include <HYDROData_Iterator.h>
+#include <HYDROData_CalculationCase.h>
 #include <Geom2d_Curve.hxx>
 #include <Geom2d_BSplineCurve.hxx>
 #include <gp_XY.hxx>
@@ -620,5 +621,30 @@ void test_HYDROData_DTM::test_garonne()
   TestViewer::showColorScale( ColorScaleIsDisp );
   delete aBathPrs;
   aDoc->Close();
+}
 
+void test_HYDROData_DTM::test_classifier_1()
+{
+  TCollection_AsciiString fname = REF_DATA_PATH.toLatin1().data();
+  fname += "/pb_1066.cbf";
+  CPPUNIT_ASSERT_EQUAL( DocError_OK, HYDROData_Document::Load( fname.ToCString(), 1 ) );
+
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  
+  Handle(HYDROData_CalculationCase) aCase = 
+    Handle(HYDROData_CalculationCase)::DownCast( aDoc->FindObjectByName( "Case_1" ) );
+  CPPUNIT_ASSERT_EQUAL( Standard_False, aCase.IsNull() ); 
+  std::vector<gp_XY> points;
+  points.push_back( gp_XY( 43.4842, 3.33176  ) );
+  points.push_back( gp_XY( -125.777, 2.24728 ) );
+  points.push_back( gp_XY( -60.1628, 168.262 ) );
+
+  std::vector<double> values = aCase->GetStricklerCoefficientForPoints( points, 0.0, true );
+  CPPUNIT_ASSERT_EQUAL( 3, (int)values.size() );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[0], EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[1], EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0221, values[2], EPS );
+
+  aDoc->Close();
 }
+
index 5eb53be1bca2b7ff9b73ee18dc5b851698cb95ba..57413786621ed5b642b4fdf15c7e8108c6f6daf6 100644 (file)
@@ -31,6 +31,7 @@ class test_HYDROData_DTM : public CppUnit::TestFixture
   CPPUNIT_TEST( test_curve_to_3d );
   CPPUNIT_TEST( test_presentation );
   CPPUNIT_TEST( test_garonne );
+  CPPUNIT_TEST( test_classifier_1 );
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -47,6 +48,7 @@ public:
   void test_curve_to_3d();
   void test_presentation();
   void test_garonne();
+  void test_classifier_1();
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_DTM );