1*a49a3f79SGaurav Gandhi // Copyright 2021 Google Inc.
2*a49a3f79SGaurav Gandhi //
3*a49a3f79SGaurav Gandhi // Licensed under the Apache License, Version 2.0 (the "License");
4*a49a3f79SGaurav Gandhi // you may not use this file except in compliance with the License.
5*a49a3f79SGaurav Gandhi // You may obtain a copy of the License at
6*a49a3f79SGaurav Gandhi //
7*a49a3f79SGaurav Gandhi // http://www.apache.org/licenses/LICENSE-2.0
8*a49a3f79SGaurav Gandhi //
9*a49a3f79SGaurav Gandhi // Unless required by applicable law or agreed to in writing, software
10*a49a3f79SGaurav Gandhi // distributed under the License is distributed on an "AS IS" BASIS,
11*a49a3f79SGaurav Gandhi // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*a49a3f79SGaurav Gandhi // See the License for the specific language governing permissions and
13*a49a3f79SGaurav Gandhi // limitations under the License.
14*a49a3f79SGaurav Gandhi
15*a49a3f79SGaurav Gandhi #include "log_handler.hpp"
16*a49a3f79SGaurav Gandhi #include "log_mock.hpp"
17*a49a3f79SGaurav Gandhi
18*a49a3f79SGaurav Gandhi #include <array>
19*a49a3f79SGaurav Gandhi #include <utility>
20*a49a3f79SGaurav Gandhi
21*a49a3f79SGaurav Gandhi #include <gtest/gtest.h>
22*a49a3f79SGaurav Gandhi
23*a49a3f79SGaurav Gandhi namespace ipmi_flash
24*a49a3f79SGaurav Gandhi {
25*a49a3f79SGaurav Gandhi
TEST(LogHandlerCanHandleTest,VerifyGoodInfoMapPasses)26*a49a3f79SGaurav Gandhi TEST(LogHandlerCanHandleTest, VerifyGoodInfoMapPasses)
27*a49a3f79SGaurav Gandhi {
28*a49a3f79SGaurav Gandhi constexpr std::array blobs{"blob0", "blob1"};
29*a49a3f79SGaurav Gandhi LogBlobHandler handler(createMockLogConfigs(blobs));
30*a49a3f79SGaurav Gandhi EXPECT_THAT(handler.getBlobIds(),
31*a49a3f79SGaurav Gandhi testing::UnorderedElementsAreArray(blobs));
32*a49a3f79SGaurav Gandhi }
33*a49a3f79SGaurav Gandhi
TEST(LogHandlerCanHandleTest,VerifyDuplicatesIgnored)34*a49a3f79SGaurav Gandhi TEST(LogHandlerCanHandleTest, VerifyDuplicatesIgnored)
35*a49a3f79SGaurav Gandhi {
36*a49a3f79SGaurav Gandhi constexpr std::array blobs{"blob0"};
37*a49a3f79SGaurav Gandhi auto configs = createMockLogConfigs(blobs);
38*a49a3f79SGaurav Gandhi configs.push_back(createMockLogConfig(blobs[0]));
39*a49a3f79SGaurav Gandhi LogBlobHandler handler(std::move(configs));
40*a49a3f79SGaurav Gandhi EXPECT_THAT(handler.getBlobIds(),
41*a49a3f79SGaurav Gandhi testing::UnorderedElementsAreArray(blobs));
42*a49a3f79SGaurav Gandhi }
43*a49a3f79SGaurav Gandhi
44*a49a3f79SGaurav Gandhi } // namespace ipmi_flash
45