Skip to content

Commit

Permalink
Test for >32 bit integer conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Oct 14, 2017
1 parent fdb5950 commit 9f34fea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,15 @@ TestPyOtherSide::testSetToList()
QVERIFY(l.contains(321));
QVERIFY(l.contains(444));
}

void
TestPyOtherSide::testIntMoreThan32Bits()
{
// See https://github.com/thp/pyotherside/issues/86
// Affected: Devices and OSes where long is 32 bits, but long long is 64 bits
long long two_fortytwo = 4398046511104LL;
PyObject *o = PyLong_FromLongLong(two_fortytwo);
QVERIFY(o);
QVariant v = convertPyObjectToQVariant(o);
QVERIFY(v.toLongLong() == two_fortytwo);
}
1 change: 1 addition & 0 deletions tests/tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TestPyOtherSide : public QObject {
void testQObjectRef();
void testConvertToPythonAndBack();
void testSetToList();
void testIntMoreThan32Bits();
};

#endif /* PYOTHERSIDE_TESTS_H */

0 comments on commit 9f34fea

Please sign in to comment.