OLD | NEW |
1 // Copyright 2008, Google Inc. | 1 // Copyright 2008, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 EXPECT_THAT(make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9), | 185 EXPECT_THAT(make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9), |
186 (Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>( | 186 (Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>( |
187 PrintsAs("(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)")))); | 187 PrintsAs("(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)")))); |
188 EXPECT_THAT(make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9), | 188 EXPECT_THAT(make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9), |
189 Not(Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>( | 189 Not(Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>( |
190 PrintsAs("(0, 8, 7, 6, 5, 4, 3, 2, 1, 0)")))); | 190 PrintsAs("(0, 8, 7, 6, 5, 4, 3, 2, 1, 0)")))); |
191 } | 191 } |
192 | 192 |
193 TEST(ArgsTest, DescirbesSelfCorrectly) { | 193 TEST(ArgsTest, DescirbesSelfCorrectly) { |
194 const Matcher<tuple<int, bool, char> > m = Args<2, 0>(Lt()); | 194 const Matcher<tuple<int, bool, char> > m = Args<2, 0>(Lt()); |
195 EXPECT_EQ("are a tuple whose fields (#2, #0) are a pair (x, y) where x < y", | 195 EXPECT_EQ("are a tuple whose fields (#2, #0) are a pair where " |
| 196 "the first < the second", |
196 Describe(m)); | 197 Describe(m)); |
197 } | 198 } |
198 | 199 |
199 TEST(ArgsTest, DescirbesNestedArgsCorrectly) { | 200 TEST(ArgsTest, DescirbesNestedArgsCorrectly) { |
200 const Matcher<const tuple<int, bool, char, int>&> m = | 201 const Matcher<const tuple<int, bool, char, int>&> m = |
201 Args<0, 2, 3>(Args<2, 0>(Lt())); | 202 Args<0, 2, 3>(Args<2, 0>(Lt())); |
202 EXPECT_EQ("are a tuple whose fields (#0, #2, #3) are a tuple " | 203 EXPECT_EQ("are a tuple whose fields (#0, #2, #3) are a tuple " |
203 "whose fields (#2, #0) are a pair (x, y) where x < y", | 204 "whose fields (#2, #0) are a pair where the first < the second", |
204 Describe(m)); | 205 Describe(m)); |
205 } | 206 } |
206 | 207 |
207 TEST(ArgsTest, DescribesNegationCorrectly) { | 208 TEST(ArgsTest, DescribesNegationCorrectly) { |
208 const Matcher<tuple<int, char> > m = Args<1, 0>(Gt()); | 209 const Matcher<tuple<int, char> > m = Args<1, 0>(Gt()); |
209 EXPECT_EQ("are a tuple whose fields (#1, #0) are a pair (x, y) " | 210 EXPECT_EQ("are a tuple whose fields (#1, #0) aren't a pair " |
210 "where x > y is false", | 211 "where the first > the second", |
211 DescribeNegation(m)); | 212 DescribeNegation(m)); |
212 } | 213 } |
213 | 214 |
214 TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) { | 215 TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) { |
215 const Matcher<tuple<bool, int, int> > m = Args<1, 2>(Eq()); | 216 const Matcher<tuple<bool, int, int> > m = Args<1, 2>(Eq()); |
216 EXPECT_EQ("whose fields (#1, #2) are (42, 42)", | 217 EXPECT_EQ("whose fields (#1, #2) are (42, 42)", |
217 Explain(m, make_tuple(false, 42, 42))); | 218 Explain(m, make_tuple(false, 42, 42))); |
218 EXPECT_EQ("whose fields (#1, #2) are (42, 43)", | 219 EXPECT_EQ("whose fields (#1, #2) are (42, 43)", |
219 Explain(m, make_tuple(false, 42, 43))); | 220 Explain(m, make_tuple(false, 42, 43))); |
220 } | 221 } |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 EXPECT_THAT(a, Contains(Contains(5))); | 1144 EXPECT_THAT(a, Contains(Contains(5))); |
1144 EXPECT_THAT(a, Not(Contains(ElementsAre(3, 4, 5)))); | 1145 EXPECT_THAT(a, Not(Contains(ElementsAre(3, 4, 5)))); |
1145 EXPECT_THAT(a, Contains(Not(Contains(5)))); | 1146 EXPECT_THAT(a, Contains(Not(Contains(5)))); |
1146 } | 1147 } |
1147 | 1148 |
1148 #ifdef _MSC_VER | 1149 #ifdef _MSC_VER |
1149 #pragma warning(pop) | 1150 #pragma warning(pop) |
1150 #endif | 1151 #endif |
1151 | 1152 |
1152 } // namespace | 1153 } // namespace |
OLD | NEW |