Skip to content

Commit a9baeb1

Browse files
committedOct 12, 2015
Add some qgsRound tests
1 parent 468012a commit a9baeb1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎tests/src/core/testqgis.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class TestQGis : public QObject
3636
void permissiveToDouble();
3737
void permissiveToInt();
3838
void doubleToString();
39+
void qgsround();
3940

4041
private:
4142
QString mReport;
@@ -136,5 +137,17 @@ void TestQGis::doubleToString()
136137
QCOMPARE( qgsDoubleToString( 12345, -1 ), QString( "12345" ) );
137138
}
138139

140+
void TestQGis::qgsround()
141+
{
142+
QCOMPARE( qgsRound( 3.141592653589793 ), 3. );
143+
QCOMPARE( qgsRound( 2.718281828459045 ), 3. );
144+
QCOMPARE( qgsRound( -3.141592653589793 ), -3. );
145+
QCOMPARE( qgsRound( -2.718281828459045 ), -3. );
146+
QCOMPARE( qgsRound( 314159265358979.3 ), 314159265358979. );
147+
QCOMPARE( qgsRound( 2718281828459.045 ), 2718281828459. );
148+
QCOMPARE( qgsRound( -314159265358979.3 ), -314159265358979. );
149+
QCOMPARE( qgsRound( -2718281828459.045 ), -2718281828459. );
150+
}
151+
139152
QTEST_MAIN( TestQGis )
140153
#include "testqgis.moc"

0 commit comments

Comments
 (0)
Please sign in to comment.