From b70d3029874f671d0eb4d0c00ec628d92c6a1c1f Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Thu, 20 Aug 2015 12:13:46 -0400 Subject: [PATCH] Add a few more expectations to crashpad_util_test InRangeCast TEST=crashpad_util_test InRangeCast.* R=rsesek@chromium.org Review URL: https://codereview.chromium.org/1300403002 . --- util/numeric/in_range_cast_test.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/numeric/in_range_cast_test.cc b/util/numeric/in_range_cast_test.cc index 5ed9b17..3ce4459 100644 --- a/util/numeric/in_range_cast_test.cc +++ b/util/numeric/in_range_cast_test.cc @@ -39,6 +39,7 @@ TEST(InRangeCast, Uint32) { EXPECT_EQ(1u, InRangeCast(UINT64_C(0x100000000), 1)); EXPECT_EQ(1u, InRangeCast(UINT64_C(0x100000001), 1)); EXPECT_EQ(1u, InRangeCast(kInt32Min, 1)); + EXPECT_EQ(1u, InRangeCast(kInt64Min, 1)); EXPECT_EQ(0xffffffffu, InRangeCast(-1, 0xffffffffu)); } @@ -58,6 +59,7 @@ TEST(InRangeCast, Int32) { EXPECT_EQ(kInt32Min, InRangeCast(implicit_cast(kInt32Min), 1)); EXPECT_EQ(1, InRangeCast(implicit_cast(kInt32Min) - 1, 1)); + EXPECT_EQ(1, InRangeCast(kInt64Min, 1)); EXPECT_EQ(0, InRangeCast(0xffffffffu, 0)); EXPECT_EQ(-1, InRangeCast(0xffffffffu, -1)); EXPECT_EQ(kInt32Min, InRangeCast(0xffffffffu, kInt32Min)); @@ -79,7 +81,6 @@ TEST(InRangeCast, Uint64) { InRangeCast(UINT64_C(0x100000001), 1)); EXPECT_EQ(1u, InRangeCast(kInt32Min, 1)); EXPECT_EQ(1u, InRangeCast(INT64_C(-1), 1)); - EXPECT_EQ(1u, InRangeCast(kInt32Min, 1)); EXPECT_EQ(1u, InRangeCast(kInt64Min, 1)); EXPECT_EQ(UINT64_C(0xffffffffffffffff), InRangeCast(-1, UINT64_C(0xffffffffffffffff))); @@ -100,11 +101,14 @@ TEST(InRangeCast, Int64) { InRangeCast(INT64_C(0x100000000), 1)); EXPECT_EQ(INT64_C(0x7fffffffffffffff), InRangeCast(INT64_C(0x7fffffffffffffff), 1)); + EXPECT_EQ(INT64_C(0x7fffffffffffffff), + InRangeCast(UINT64_C(0x7fffffffffffffff), 1)); EXPECT_EQ(1, InRangeCast(UINT64_C(0x8000000000000000), 1)); EXPECT_EQ(1, InRangeCast(UINT64_C(0xffffffffffffffff), 1)); EXPECT_EQ(kInt32Min, InRangeCast(kInt32Min, 1)); EXPECT_EQ(kInt32Min, InRangeCast(implicit_cast(kInt32Min), 1)); + EXPECT_EQ(kInt64Min, InRangeCast(kInt64Min, 1)); EXPECT_EQ(0, InRangeCast(UINT64_C(0xffffffffffffffff), 0)); EXPECT_EQ(-1, InRangeCast(UINT64_C(0xffffffffffffffff), -1)); EXPECT_EQ(kInt64Min,