Skip to content

Commit

Permalink
Add unit test for conversion from small negative longlong.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni authored and nyalldawson committed May 17, 2020
1 parent 23562ab commit aacb31f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/src/core/testqgsfield.cpp
Expand Up @@ -550,6 +550,16 @@ void TestQgsField::convertCompatible()
QVERIFY( intField.convertCompatible( smallLonglong ) );
QCOMPARE( smallLonglong.type(), QVariant::Int );
QCOMPARE( smallLonglong, QVariant( 99 ) );
// negative longlong to int
QVariant negativeLonglong( -99999999999999999LL );
QVERIFY( !intField.convertCompatible( negativeLonglong ) );
QCOMPARE( negativeLonglong.type(), QVariant::Int );
QVERIFY( negativeLonglong.isNull() );
// small negative longlong to int
QVariant smallNegativeLonglong( -99LL );
QVERIFY( intField.convertCompatible( smallNegativeLonglong ) );
QCOMPARE( smallNegativeLonglong.type(), QVariant::Int );
QCOMPARE( smallNegativeLonglong, QVariant( -99 ) );

//string representation of an int
QVariant stringInt( "123456" );
Expand Down

0 comments on commit aacb31f

Please sign in to comment.