Flutter Engine
The Flutter Engine
container_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <unordered_map>
6
7#include "flutter/fml/container.h"
8
9#include "gtest/gtest.h"
10
11namespace fml {
12namespace {
13
14TEST(ContainerTest, MapEraseIf) {
15 std::unordered_map<int, int> map = {{0, 1}, {2, 3}, {4, 5}};
16
17 fml::erase_if(map, [](std::unordered_map<int, int>::iterator it) {
18 return it->first == 0 || it->second == 5;
19 });
20
21 EXPECT_EQ(map.size(), 1u);
22 EXPECT_TRUE(map.find(2) != map.end());
23}
24
25} // namespace
26} // namespace fml
Definition: ascii_trie.cc:9
void erase_if(Collection &container, std::function< bool(typename Collection::iterator)> predicate)
Definition: container.h:16
TEST(MallocMapping, EmptyContructor)
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Definition: SkVx.h:680
#define EXPECT_TRUE(handle)
Definition: unit_test.h:678