OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "net/base/int128.h" | 7 #include "net/base/int128.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 EXPECT_EQ(test &= one, one); | 103 EXPECT_EQ(test &= one, one); |
104 EXPECT_EQ(test ^= three, two); | 104 EXPECT_EQ(test ^= three, two); |
105 EXPECT_EQ(test >>= 1, one); | 105 EXPECT_EQ(test >>= 1, one); |
106 EXPECT_EQ(test <<= 1, two); | 106 EXPECT_EQ(test <<= 1, two); |
107 | 107 |
108 EXPECT_EQ(big, -(-big)); | 108 EXPECT_EQ(big, -(-big)); |
109 EXPECT_EQ(two, -((-one) - 1)); | 109 EXPECT_EQ(two, -((-one) - 1)); |
110 EXPECT_EQ(kuint128max, -one); | 110 EXPECT_EQ(kuint128max, -one); |
111 EXPECT_EQ(zero, -zero); | 111 EXPECT_EQ(zero, -zero); |
112 | 112 |
113 LOG(INFO) << one; | 113 VLOG(0) << one; |
114 LOG(INFO) << big_minus_one; | 114 VLOG(0) << big_minus_one; |
Ryan Sleevi
2013/11/25 01:08:32
just delete these?
scottmg
2013/11/25 17:12:38
Done.
| |
115 } | 115 } |
116 | 116 |
117 TEST(Int128, PodTests) { | 117 TEST(Int128, PodTests) { |
118 uint128_pod pod = { 12345, 67890 }; | 118 uint128_pod pod = { 12345, 67890 }; |
119 uint128 from_pod(pod); | 119 uint128 from_pod(pod); |
120 EXPECT_EQ(12345u, Uint128High64(from_pod)); | 120 EXPECT_EQ(12345u, Uint128High64(from_pod)); |
121 EXPECT_EQ(67890u, Uint128Low64(from_pod)); | 121 EXPECT_EQ(67890u, Uint128Low64(from_pod)); |
122 | 122 |
123 uint128 zero(0); | 123 uint128 zero(0); |
124 uint128_pod zero_pod = {0, 0}; | 124 uint128_pod zero_pod = {0, 0}; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 uint128 x1(1, 2); | 256 uint128 x1(1, 2); |
257 uint128 x2(2, 4); | 257 uint128 x2(2, 4); |
258 x1 += x1; | 258 x1 += x1; |
259 EXPECT_EQ(x2, x1); | 259 EXPECT_EQ(x2, x1); |
260 | 260 |
261 uint128 x3(1, 1ull << 63); | 261 uint128 x3(1, 1ull << 63); |
262 uint128 x4(3, 0); | 262 uint128 x4(3, 0); |
263 x3 += x3; | 263 x3 += x3; |
264 EXPECT_EQ(x4, x3); | 264 EXPECT_EQ(x4, x3); |
265 } | 265 } |
OLD | NEW |