From: adv Date: Wed, 30 Oct 2013 09:48:30 +0000 (+0000) Subject: Testing of Bathymetry object. X-Git-Tag: BR_hydro_v_0_3~68 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bab0e234b3be26dfe1b99e9ba43cc39bed79133a;p=modules%2Fhydro.git Testing of Bathymetry object. --- diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index 66223a3a..0de39887 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -91,11 +91,9 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() c if ( !myLab.FindChild( DataTag_AltitudePoints ).FindAttribute( TDataStd_RealArray::GetID(), aCoordsArray ) ) return aPoints; - int aLowerIdx = aCoordsArray->Lower(); - int anUpperIdx = aCoordsArray->Upper(); for ( int i = aCoordsArray->Lower(), n = aCoordsArray->Upper(); i <= n; ) { - if ( i + 3 > n ) + if ( i + 3 > n + 1 ) break; AltitudePoint aPoint; diff --git a/src/HYDROData/test_HYDROData_Bathymetry.cxx b/src/HYDROData/test_HYDROData_Bathymetry.cxx index 2a1a95c2..51f61efa 100755 --- a/src/HYDROData/test_HYDROData_Bathymetry.cxx +++ b/src/HYDROData/test_HYDROData_Bathymetry.cxx @@ -62,34 +62,34 @@ void test_HYDROData_Bathymetry::testFileImport() if ( !createTestFile( aFileName ) ) return; // No file has been created - CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName ) != true ); + CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName ) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry->GetAltitudePoints(); - CPPUNIT_ASSERT( anAltitudePoints.length() != 16 ); + CPPUNIT_ASSERT( anAltitudePoints.length() == 20 ); gp_XY aTestPoint( 1, 1 ); double anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT( !ValuesEquals( anAltitude, 10.0 ) ); + CPPUNIT_ASSERT( ValuesEquals( anAltitude, 10.0 ) ); aTestPoint = gp_XY( 0.5, 0.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT( !ValuesEquals( anAltitude, 5.0 ) ); + CPPUNIT_ASSERT( ValuesEquals( anAltitude, 5.0 ) ); aTestPoint = gp_XY( 1.5, 1 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT( !ValuesEquals( anAltitude, 10.0 ) ); + CPPUNIT_ASSERT( ValuesEquals( anAltitude, 10.0 ) ); aTestPoint = gp_XY( 1.5, 0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT( !ValuesEquals( anAltitude, 7.0 ) ); + CPPUNIT_ASSERT( ValuesEquals( anAltitude, 7.0 ) ); aTestPoint = gp_XY( 1.5, -0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT( !ValuesEquals( anAltitude, HYDROData_Bathymetry::GetInvalidAltitude() ) ); + CPPUNIT_ASSERT( ValuesEquals( anAltitude, HYDROData_Bathymetry::GetInvalidAltitude() ) ); aTestPoint = gp_XY( 2, 3.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT( !ValuesEquals( anAltitude, 35.0 ) ); + CPPUNIT_ASSERT( ValuesEquals( anAltitude, 35.0 ) ); aDoc->Close(); } @@ -108,10 +108,10 @@ void test_HYDROData_Bathymetry::testCopy() if ( anIsFileCreated ) { - CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName ) != true ); + CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName ) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry1->GetAltitudePoints(); - CPPUNIT_ASSERT( anAltitudePoints.length() != 16 ); + CPPUNIT_ASSERT( anAltitudePoints.length() == 20 ); } Handle(HYDROData_Bathymetry) aBathymetry2 = @@ -122,7 +122,7 @@ void test_HYDROData_Bathymetry::testCopy() if ( anIsFileCreated ) { HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry2->GetAltitudePoints(); - CPPUNIT_ASSERT( anAltitudePoints.length() != 16 ); + CPPUNIT_ASSERT( anAltitudePoints.length() == 20 ); } aDoc->Close();