diff options
author | Gil <mcg@google.com> | 2018-04-19 11:30:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-19 11:30:29 -0700 |
commit | 0df8378971553a203cc6982a298f342baecae543 (patch) | |
tree | 0db33e6bea1cb4ed6ca74ad299eb868bdb943693 /Firestore/core/test/firebase/firestore/immutable/testing.h | |
parent | 81ac1761e2195aa2f16c0377471e084910ccdb35 (diff) |
Implement iterators for our immutable maps (#1132)
* Add a minimal LlrbNodeIterator
* Remove fixed_size type parameter from FixedArray
The parameter wasn't that useful and caused problems in trying to define
dependent iterator types.
* Add begin()/end() to SortedMap.
Diffstat (limited to 'Firestore/core/test/firebase/firestore/immutable/testing.h')
-rw-r--r-- | Firestore/core/test/firebase/firestore/immutable/testing.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Firestore/core/test/firebase/firestore/immutable/testing.h b/Firestore/core/test/firebase/firestore/immutable/testing.h index 337140f..0b25b66 100644 --- a/Firestore/core/test/firebase/firestore/immutable/testing.h +++ b/Firestore/core/test/firebase/firestore/immutable/testing.h @@ -144,16 +144,26 @@ Container ToMap(const std::vector<int>& values) { return result; } +template <typename Container> +std::vector<int> Keys(const Container& container) { + std::vector<int> keys; + for (const auto& element : container) { + keys.push_back(element.first); + } + return keys; +} + /** * Appends the contents of the given container to a new vector. */ template <typename Container> -std::vector<typename Container::value_type> Append(const Container& container) { +std::vector<typename Container::value_type> Collect( + const Container& container) { return {container.begin(), container.end()}; } -#define ASSERT_SEQ_EQ(x, y) ASSERT_EQ((x), Append(y)); -#define EXPECT_SEQ_EQ(x, y) EXPECT_EQ((x), Append(y)); +#define ASSERT_SEQ_EQ(x, y) ASSERT_EQ((x), Collect(y)); +#define EXPECT_SEQ_EQ(x, y) EXPECT_EQ((x), Collect(y)); } // namespace immutable } // namespace firestore |