OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "net/der/parse_values.h" | 8 #include "net/der/parse_values.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 ASSERT_TRUE( | 166 ASSERT_TRUE( |
167 ParseGeneralizedTime(FromStringLiteral("20140218161200Z"), &time1)); | 167 ParseGeneralizedTime(FromStringLiteral("20140218161200Z"), &time1)); |
168 // Test that ParseUTCTime correctly normalizes the year. | 168 // Test that ParseUTCTime correctly normalizes the year. |
169 ASSERT_TRUE(ParseUTCTime(FromStringLiteral("150218161200Z"), &time2)); | 169 ASSERT_TRUE(ParseUTCTime(FromStringLiteral("150218161200Z"), &time2)); |
170 ASSERT_TRUE(ParseUTCTimeRelaxed(FromStringLiteral("1503070000Z"), &time3)); | 170 ASSERT_TRUE(ParseUTCTimeRelaxed(FromStringLiteral("1503070000Z"), &time3)); |
171 ASSERT_TRUE( | 171 ASSERT_TRUE( |
172 ParseGeneralizedTime(FromStringLiteral("20160218161200Z"), &time4)); | 172 ParseGeneralizedTime(FromStringLiteral("20160218161200Z"), &time4)); |
173 EXPECT_TRUE(time1 < time2); | 173 EXPECT_TRUE(time1 < time2); |
174 EXPECT_TRUE(time2 < time3); | 174 EXPECT_TRUE(time2 < time3); |
175 EXPECT_TRUE(time3 < time4); | 175 EXPECT_TRUE(time3 < time4); |
| 176 |
| 177 EXPECT_TRUE(time2 > time1); |
| 178 EXPECT_TRUE(time2 >= time1); |
| 179 EXPECT_TRUE(time3 <= time4); |
| 180 EXPECT_TRUE(time1 <= time1); |
| 181 EXPECT_TRUE(time1 >= time1); |
176 } | 182 } |
177 | 183 |
178 struct Uint64TestData { | 184 struct Uint64TestData { |
179 bool should_pass; | 185 bool should_pass; |
180 const uint8_t input[9]; | 186 const uint8_t input[9]; |
181 size_t length; | 187 size_t length; |
182 uint64_t expected_value; | 188 uint64_t expected_value; |
183 }; | 189 }; |
184 | 190 |
185 const Uint64TestData kUint64TestData[] = { | 191 const Uint64TestData kUint64TestData[] = { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 TEST(ParseValuesTest, ParseBitStringSevenOneBitsUnusedBitIsOne) { | 361 TEST(ParseValuesTest, ParseBitStringSevenOneBitsUnusedBitIsOne) { |
356 const uint8_t kData[] = {0x01, 0xFF}; | 362 const uint8_t kData[] = {0x01, 0xFF}; |
357 | 363 |
358 BitString bit_string; | 364 BitString bit_string; |
359 EXPECT_FALSE(ParseBitString(Input(kData), &bit_string)); | 365 EXPECT_FALSE(ParseBitString(Input(kData), &bit_string)); |
360 } | 366 } |
361 | 367 |
362 } // namespace test | 368 } // namespace test |
363 } // namespace der | 369 } // namespace der |
364 } // namespace net | 370 } // namespace net |
OLD | NEW |