From: asl Date: Fri, 16 Oct 2015 12:29:01 +0000 (+0300) Subject: code revision for Linux X-Git-Tag: v1.5~98^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8075cf84837a78faf36f4495df0728a9a4b8fd8b;p=modules%2Fhydro.git code revision for Linux --- diff --git a/src/HYDRO_tests/random.cxx b/src/HYDRO_tests/random.cxx index da51deba..c0f11572 100644 --- a/src/HYDRO_tests/random.cxx +++ b/src/HYDRO_tests/random.cxx @@ -1,16 +1,16 @@ #include -int m_w = 1; -int m_z = 1; +quint32 m_w = 1; +quint32 m_z = 1; -void test_srand( unsigned int theValue ) +void test_srand( quint32 theValue ) { m_w = theValue + 1; m_z = theValue / 2; } -unsigned int test_rand() +quint32 test_rand() { m_z = 36969 * (m_z & 65535) + (m_z >> 16); m_w = 18000 * (m_w & 65535) + (m_w >> 16); diff --git a/src/HYDRO_tests/random.h b/src/HYDRO_tests/random.h index bc8800b2..d6901117 100644 --- a/src/HYDRO_tests/random.h +++ b/src/HYDRO_tests/random.h @@ -1,5 +1,7 @@ #pragma once -void test_srand( unsigned int theValue ); -unsigned int test_rand(); +#include + +void test_srand( quint32 theValue ); +quint32 test_rand(); diff --git a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx index 28a22cfe..9b6535f3 100644 --- a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx +++ b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx @@ -46,7 +46,7 @@ void generateOne( QTextStream& theStream, { double anX = theFirstX * (1-t) + theLastX * t; double anY = theFirstY * (1-t) + theLastY * t; - double aZ = aStepZ * aStepZ + sin( (float)rand() ); + double aZ = aStepZ * aStepZ + sin( 10*t ); theStream << anX << " " << anY << " " << aZ << " \n"; aStepZ += 0.2; @@ -62,7 +62,6 @@ bool test_HYDROData_Bathymetry::createTestFile( const QString& theFileName ) { QTextStream anOutStream( &aTmpFile ); - test_srand( 4587 ); generateOne( anOutStream, 0, 5, 0, -5 ); generateOne( anOutStream, 10, 5, 10, -5 ); generateOne( anOutStream, 20, 5, 20, -5 ); @@ -109,7 +108,6 @@ bool test_HYDROData_Bathymetry::createTestFile( const QString& theFileName ) generateOne( anOutStream, 1040.079834, -441.303467, 1017.623413, -459.9102175 ); generateOne( anOutStream, 1055.478516, -456.060547, 1034.946899, -475.9505 ); generateOne( anOutStream, 1074.085327, -474.025665, 1058.044922, -493.274017 ); - test_srand( 0 ); } aTmpFile.close(); @@ -135,27 +133,27 @@ void test_HYDROData_Bathymetry::testFileImport() gp_XY aTestPoint( 1, 1 ); double anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.9186, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.2432, anAltitude, EPS ); aTestPoint = gp_XY( 0.5, 0.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.3452, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.3816, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, 1 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.9157, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.2432, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, 0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.8782, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.1608, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, -0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.9678, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0093, anAltitude, EPS ); aTestPoint = gp_XY( 2, 3.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 12.4364, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 12.6829, anAltitude, EPS ); aDoc->Close(); }