PolicyManager: Move payload_size to int64_t.
Code style encourages signed types instead of unsigned types and the
value being exposed is already signed. This patch fixes that for the
payload_size variable and adapts the BoxedValue::ValuePrinter
implementations to use the int64_t and uint64_t types.
BUG=None
TEST=Unit tests updated
Change-Id: I21310c59d8c2654c43cac27265055c8577341562
Reviewed-on: https://chromium-review.googlesource.com/198269
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/boxed_value_unittest.cc b/policy_manager/boxed_value_unittest.cc
index 6319ba7..a84604d 100644
--- a/policy_manager/boxed_value_unittest.cc
+++ b/policy_manager/boxed_value_unittest.cc
@@ -102,19 +102,21 @@
EXPECT_EQ("42", BoxedValue(new int(42)).ToString());
}
+TEST(PmBoxedValueTest, Int64ToString) {
+ // -123456789012345 doensn't fit in 32-bit integers.
+ EXPECT_EQ("-123456789012345", BoxedValue(
+ new int64_t(-123456789012345LL)).ToString());
+}
+
TEST(PmBoxedValueTest, UnsignedIntToString) {
// 4294967295 is the biggest possible 32-bit unsigned integer.
- EXPECT_EQ("4294967295", BoxedValue(new unsigned int(4294967295)).ToString());
+ EXPECT_EQ("4294967295", BoxedValue(new unsigned int(4294967295U)).ToString());
}
-TEST(PmBoxedValueTest, UnsignedLongToString) {
- EXPECT_EQ("4294967295", BoxedValue(new unsigned long(4294967295)).ToString());
-}
-
-TEST(PmBoxedValueTest, UnsignedLongLongToString) {
+TEST(PmBoxedValueTest, UnsignedInt64ToString) {
// 18446744073709551615 is the biggest possible 64-bit unsigned integer.
EXPECT_EQ("18446744073709551615", BoxedValue(
- new unsigned long long(18446744073709551615ULL)).ToString());
+ new uint64_t(18446744073709551615ULL)).ToString());
}
TEST(PmBoxedValueTest, BoolToString) {