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
3 // found in the LICENSE file.
5 #include "net/quic/quic_utils_chromium.h"
9 #include "testing/gtest/include/gtest/gtest.h"
17 TEST(QuicUtilsChromiumTest
, FindOrNullTest
) {
22 int* p1
= FindOrNull(m
, 0);
25 const map
<int, int>& const_m
= m
;
26 const int* p2
= FindOrNull(const_m
, 0);
28 CHECK(FindOrNull(m
, 1) == NULL
);
31 TEST(QuicUtilsChromiumTest
, FindOrDieTest
) {
34 EXPECT_EQ(15, FindOrDie(m
, 10));
35 // TODO(rtenneti): Use the latest DEATH macros after merging with latest rch's
37 // ASSERT_DEATH(FindOrDie(m, 8), "Map key not found: 8");
39 // Make sure the non-const reference returning version works.
40 FindOrDie(m
, 10) = 20;
41 EXPECT_EQ(20, FindOrDie(m
, 10));
43 // Make sure we can lookup values in a const map.
44 const map
<int, int>& const_m
= m
;
45 EXPECT_EQ(20, FindOrDie(const_m
, 10));