Skip to content
Permalink
Browse files

Add unit test for conversion from small negative longlong.

  • Loading branch information
ismailsunni authored and nyalldawson committed May 17, 2020
1 parent 23562ab commit aacb31f66be729bd6f02cd8c15073deb1faff05c
Showing with 10 additions and 0 deletions.
  1. +10 −0 tests/src/core/testqgsfield.cpp
@@ -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" );

0 comments on commit aacb31f

Please sign in to comment.
You can’t perform that action at this time.