1 // Copyright 2021 The Tint Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "src/utils/reverse.h"
16
17 #include <vector>
18
19 #include "gmock/gmock.h"
20
21 namespace tint {
22 namespace utils {
23 namespace {
24
TEST(ReverseTest,Vector)25 TEST(ReverseTest, Vector) {
26 std::vector<int> vec{1, 3, 5, 7, 9};
27 std::vector<int> rev;
28 for (auto v : Reverse(vec)) {
29 rev.emplace_back(v);
30 }
31 ASSERT_THAT(rev, testing::ElementsAre(9, 7, 5, 3, 1));
32 }
33
34 } // namespace
35 } // namespace utils
36 } // namespace tint
37