From 0c03c28a3b7609d218a9acdff099fc0bda0f4ae6 Mon Sep 17 00:00:00 2001 From: Gil Date: Fri, 20 Apr 2018 12:11:19 -0700 Subject: Implement find-related methods on C++ immutable maps (#1145) * Standardize method ordering across sorted maps * Add SortedMap::find * Add SortedMap::find_index * Add SortedMap::contains --- Firestore/core/test/firebase/firestore/immutable/testing.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Firestore/core/test/firebase/firestore/immutable/testing.h') diff --git a/Firestore/core/test/firebase/firestore/immutable/testing.h b/Firestore/core/test/firebase/firestore/immutable/testing.h index 0b25b66..9e839c6 100644 --- a/Firestore/core/test/firebase/firestore/immutable/testing.h +++ b/Firestore/core/test/firebase/firestore/immutable/testing.h @@ -30,6 +30,11 @@ namespace immutable { template testing::AssertionResult NotFound(const Container& map, const K& key) { + if (map.contains(key)) { + return testing::AssertionFailure() + << "Should not have found " << key << " using contains()"; + } + auto found = map.find(key); if (found == map.end()) { return testing::AssertionSuccess(); @@ -44,9 +49,15 @@ template testing::AssertionResult Found(const Container& map, const K& key, const V& expected) { + if (!map.contains(key)) { + return testing::AssertionFailure() + << "Did not find key " << key << " using contains()"; + } + auto found = map.find(key); if (found == map.end()) { - return testing::AssertionFailure() << "Did not find key " << key; + return testing::AssertionFailure() + << "Did not find key " << key << " using find()"; } if (found->second == expected) { return testing::AssertionSuccess(); -- cgit v1.2.3