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/values.h" | 5 #include "base/values.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <type_traits> | 12 #include <type_traits> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/template_util.h" | |
20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
21 | 20 |
22 namespace base { | 21 namespace base { |
23 | 22 |
24 TEST(ValuesTest, TestNothrow) { | 23 TEST(ValuesTest, TestNothrow) { |
25 // TODO(crbug.com/554293): Replace this with | 24 static_assert(std::is_nothrow_move_constructible<Value>::value, |
26 // std::is_nothrow_move_constructible when all platforms have them in the std | |
27 // namespace. | |
28 static_assert(std::is_nothrow_constructible<Value, Value&&>::value, | |
29 "IsNothrowMoveConstructible"); | 25 "IsNothrowMoveConstructible"); |
30 // TODO(crbug.com/554293): Replace this with | 26 static_assert(std::is_nothrow_default_constructible<Value>::value, |
31 // std::is_nothrow_default_constructible when all platforms have them in the | |
32 // std namespace. | |
33 static_assert(std::is_nothrow_constructible<Value>::value, | |
34 "IsNothrowDefaultConstructible"); | 27 "IsNothrowDefaultConstructible"); |
35 static_assert(std::is_nothrow_constructible<Value, std::string&&>::value, | 28 static_assert(std::is_nothrow_constructible<Value, std::string&&>::value, |
36 "IsNothrowMoveConstructibleFromString"); | 29 "IsNothrowMoveConstructibleFromString"); |
37 static_assert( | 30 static_assert( |
38 std::is_nothrow_constructible<Value, std::vector<char>&&>::value, | 31 std::is_nothrow_constructible<Value, std::vector<char>&&>::value, |
39 "IsNothrowMoveConstructibleFromBlob"); | 32 "IsNothrowMoveConstructibleFromBlob"); |
| 33 static_assert(std::is_nothrow_move_assignable<Value>::value, |
| 34 "IsNothrowMoveAssignable"); |
40 } | 35 } |
41 | 36 |
42 // Group of tests for the value constructors. | 37 // Group of tests for the value constructors. |
43 TEST(ValuesTest, ConstructBool) { | 38 TEST(ValuesTest, ConstructBool) { |
44 Value true_value(true); | 39 Value true_value(true); |
45 EXPECT_EQ(Value::Type::BOOLEAN, true_value.type()); | 40 EXPECT_EQ(Value::Type::BOOLEAN, true_value.type()); |
46 EXPECT_TRUE(true_value.GetBool()); | 41 EXPECT_TRUE(true_value.GetBool()); |
47 | 42 |
48 Value false_value(false); | 43 Value false_value(false); |
49 EXPECT_EQ(Value::Type::BOOLEAN, false_value.type()); | 44 EXPECT_EQ(Value::Type::BOOLEAN, false_value.type()); |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 EXPECT_FALSE(main_list.GetList(1, NULL)); | 1513 EXPECT_FALSE(main_list.GetList(1, NULL)); |
1519 EXPECT_FALSE(main_list.GetList(2, NULL)); | 1514 EXPECT_FALSE(main_list.GetList(2, NULL)); |
1520 EXPECT_FALSE(main_list.GetList(3, NULL)); | 1515 EXPECT_FALSE(main_list.GetList(3, NULL)); |
1521 EXPECT_FALSE(main_list.GetList(4, NULL)); | 1516 EXPECT_FALSE(main_list.GetList(4, NULL)); |
1522 EXPECT_FALSE(main_list.GetList(5, NULL)); | 1517 EXPECT_FALSE(main_list.GetList(5, NULL)); |
1523 EXPECT_TRUE(main_list.GetList(6, NULL)); | 1518 EXPECT_TRUE(main_list.GetList(6, NULL)); |
1524 EXPECT_FALSE(main_list.GetList(7, NULL)); | 1519 EXPECT_FALSE(main_list.GetList(7, NULL)); |
1525 } | 1520 } |
1526 | 1521 |
1527 } // namespace base | 1522 } // namespace base |
OLD | NEW |