Skip to content

Commit

Permalink
edge tests
Browse files Browse the repository at this point in the history
  • Loading branch information
igormcoelho committed Jul 24, 2019
1 parent bff08b7 commit 3a78240
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: gmp
all: gmp dotnet

gmp:
g++ -std=c++11 -Ofast --shared src/csBigIntegerLib.cpp src/BigIntegerGMP.cpp -lgmp -lgmpxx -o build/csbiginteger_gmp.so -fPIC
Expand Down
20 changes: 20 additions & 0 deletions tests/serialize-tests/serialize.Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,3 +1214,23 @@ TEST(csBISerializeTests, BigInteger_Special5)
{
EXPECT_EQ(BigInteger(8) >> BigInteger(-3), 64);
}

// limits (2^31-1): max int positive
TEST(csBISerializeTests, BigInteger_Limit2147483647)
{
BigInteger big0;
BigInteger big1(2147483647);
EXPECT_EQ(big1.ToString(10), "2147483647");
EXPECT_EQ(big1.ToString(16), "0x7fffffff");
EXPECT_EQ(big0 < big1, true);
EXPECT_EQ(big0 > big1, false);
EXPECT_EQ(big1 < big0, false);
EXPECT_EQ(big1 > big0, true);
// variants
EXPECT_EQ(big0 < (big1-1), true);
EXPECT_EQ(big0 < (big1-2), true);
EXPECT_EQ(big0 < (big1+0), true);
EXPECT_EQ(big0 < (big1+1), true);
EXPECT_EQ(big0 < (big1+2), true);
}

0 comments on commit 3a78240

Please sign in to comment.