Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: net/quic/quic_utils_chromium_test.cc

Issue 612323013: QUIC - (no behavior change) s/NULL/nullptr/g in .../quic/... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_utils.h ('k') | net/quic/reliable_quic_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/quic/quic_utils_chromium.h" 5 #include "net/quic/quic_utils_chromium.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 using std::map; 11 using std::map;
12 12
13 namespace net { 13 namespace net {
14 namespace test { 14 namespace test {
15 namespace { 15 namespace {
16 16
17 TEST(QuicUtilsChromiumTest, FindOrNullTest) { 17 TEST(QuicUtilsChromiumTest, FindOrNullTest) {
18 map<int, int> m; 18 map<int, int> m;
19 m[0] = 2; 19 m[0] = 2;
20 20
21 // Check FindOrNull 21 // Check FindOrNull
22 int* p1 = FindOrNull(m, 0); 22 int* p1 = FindOrNull(m, 0);
23 CHECK_EQ(*p1, 2); 23 CHECK_EQ(*p1, 2);
24 ++(*p1); 24 ++(*p1);
25 const map<int, int>& const_m = m; 25 const map<int, int>& const_m = m;
26 const int* p2 = FindOrNull(const_m, 0); 26 const int* p2 = FindOrNull(const_m, 0);
27 CHECK_EQ(*p2, 3); 27 CHECK_EQ(*p2, 3);
28 CHECK(FindOrNull(m, 1) == NULL); 28 CHECK(FindOrNull(m, 1) == nullptr);
29 } 29 }
30 30
31 TEST(QuicUtilsChromiumTest, FindOrDieTest) { 31 TEST(QuicUtilsChromiumTest, FindOrDieTest) {
32 std::map<int, int> m; 32 std::map<int, int> m;
33 m[10] = 15; 33 m[10] = 15;
34 EXPECT_EQ(15, FindOrDie(m, 10)); 34 EXPECT_EQ(15, FindOrDie(m, 10));
35 // TODO(rtenneti): Use the latest DEATH macros after merging with latest rch's 35 // TODO(rtenneti): Use the latest DEATH macros after merging with latest rch's
36 // changes. 36 // changes.
37 // ASSERT_DEATH(FindOrDie(m, 8), "Map key not found: 8"); 37 // ASSERT_DEATH(FindOrDie(m, 8), "Map key not found: 8");
38 38
39 // Make sure the non-const reference returning version works. 39 // Make sure the non-const reference returning version works.
40 FindOrDie(m, 10) = 20; 40 FindOrDie(m, 10) = 20;
41 EXPECT_EQ(20, FindOrDie(m, 10)); 41 EXPECT_EQ(20, FindOrDie(m, 10));
42 42
43 // Make sure we can lookup values in a const map. 43 // Make sure we can lookup values in a const map.
44 const map<int, int>& const_m = m; 44 const map<int, int>& const_m = m;
45 EXPECT_EQ(20, FindOrDie(const_m, 10)); 45 EXPECT_EQ(20, FindOrDie(const_m, 10));
46 } 46 }
47 47
48 } // namespace 48 } // namespace
49 } // namespace test 49 } // namespace test
50 } // namespace net 50 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_utils.h ('k') | net/quic/reliable_quic_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698