tools/qa/cppunit/test_bigint.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
New commits: commit 08e566f0c97fb6cc2ee17813e81c221a8d7154c0 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Nov 15 11:20:35 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Nov 15 11:38:18 2024 +0100 add a couple of tests for tools::BigInt because I might touch this area and I want to be sure I don't mess it up Change-Id: I62c177031f690f4455a58f3280ed26186df94158 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/tools/qa/cppunit/test_bigint.cxx b/tools/qa/cppunit/test_bigint.cxx index 065a2719b9b3..a8d3f069a54a 100644 --- a/tools/qa/cppunit/test_bigint.cxx +++ b/tools/qa/cppunit/test_bigint.cxx @@ -91,6 +91,24 @@ void BigIntTest::testConstructionFromLongLong() CPPUNIT_ASSERT(bi.IsNeg()); CPPUNIT_ASSERT(bi.IsBig()); } + + // max possible sal_Int64 negative number + { + BigInt bi(static_cast<sal_Int64>(std::numeric_limits<sal_Int64>::min())); + CPPUNIT_ASSERT(!bi.IsZero()); + CPPUNIT_ASSERT(bi.IsNeg()); + CPPUNIT_ASSERT(bi.IsBig()); + CPPUNIT_ASSERT_EQUAL(std::numeric_limits<sal_Int64>::min(), static_cast<sal_Int64>(bi)); + } + + // max possible sal_Int64 positive number + { + BigInt bi(static_cast<sal_Int64>(std::numeric_limits<sal_Int64>::max())); + CPPUNIT_ASSERT(!bi.IsZero()); + CPPUNIT_ASSERT(!bi.IsNeg()); + CPPUNIT_ASSERT(bi.IsBig()); + CPPUNIT_ASSERT_EQUAL(std::numeric_limits<sal_Int64>::max(), static_cast<sal_Int64>(bi)); + } } void BigIntTest::testLenB1()