OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 ASSERT_ANY_THROW(response >> int64Value); | 105 ASSERT_ANY_THROW(response >> int64Value); |
106 ASSERT_ANY_THROW(response >> int32Value); | 106 ASSERT_ANY_THROW(response >> int32Value); |
107 ASSERT_ANY_THROW(response >> boolValue); | 107 ASSERT_ANY_THROW(response >> boolValue); |
108 | 108 |
109 ASSERT_EQ("Foo Received", stringValue); | 109 ASSERT_EQ("Foo Received", stringValue); |
110 ASSERT_EQ(L"Bar \u043f\u0440\u0438\u043d\u044f\u0442\u043e", wstringValue); | 110 ASSERT_EQ(L"Bar \u043f\u0440\u0438\u043d\u044f\u0442\u043e", wstringValue); |
111 ASSERT_EQ(9876543211L, int64Value); | 111 ASSERT_EQ(9876543211L, int64Value); |
112 ASSERT_EQ(7, int32Value); | 112 ASSERT_EQ(7, int32Value); |
113 ASSERT_FALSE(boolValue); | 113 ASSERT_FALSE(boolValue); |
114 } | 114 } |
| 115 |
| 116 void SendReceiveStrings(const std::vector<std::string>& src) |
| 117 { |
| 118 Communication::OutputBuffer outputBuffer; |
| 119 outputBuffer << src; |
| 120 Communication::InputBuffer inputBuffer(outputBuffer.Get()); |
| 121 std::vector<std::string> dst; |
| 122 inputBuffer >> dst; |
| 123 auto dstSize = dst.size(); |
| 124 ASSERT_EQ(dstSize, src.size()); |
| 125 for (auto i = 0; i < dstSize; ++i) |
| 126 { |
| 127 EXPECT_EQ(dst[i], src[i]); |
| 128 } |
| 129 } |
| 130 |
| 131 TEST(InputOutputBuffersTests, EmptyStrings) |
| 132 { |
| 133 SendReceiveStrings(std::vector<std::string>()); |
| 134 } |
| 135 |
| 136 TEST(InputOutputBuffersTests, StringsWithOneValue) |
| 137 { |
| 138 std::vector<std::string> src; |
| 139 src.emplace_back("string1"); |
| 140 SendReceiveStrings(src); |
| 141 } |
| 142 |
| 143 TEST(InputOutputBuffersTests, MultivalueStrings) |
| 144 { |
| 145 std::vector<std::string> src; |
| 146 src.emplace_back("string1"); |
| 147 src.emplace_back("str2"); |
| 148 src.emplace_back("value"); |
| 149 SendReceiveStrings(src); |
| 150 } |
OLD | NEW |