1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
8 #include <gmock/gmock-matchers.h>
9 #include "nnet_base_matcher.hpp"
11 class InputDataMatcher : public ::testing::MatcherInterface<const intel_nnet_type_t *> {
12 std::vector<int16_t> refInput;
15 explicit InputDataMatcher(const std::vector<int16_t> &_refInput) : refInput(_refInput) {}
17 bool MatchAndExplain(const intel_nnet_type_t *foo, ::testing::MatchResultListener *listener) const override {
18 if (foo->pLayers == nullptr) {
19 *listener << "Address of the first layer descriptor is NULL";
22 auto firstLayer = foo->pLayers[0];
23 auto actualInput = firstLayer.pInputs;
25 *listener << "Input of the first layer is NULL";
29 auto *actualInputI16 = reinterpret_cast<int16_t *>(actualInput);
30 for (int i = 0; i < refInput.size(); i++) {
31 if (actualInputI16[i] != refInput[i]) {
32 *listener << "Actual and reference value of input doesn't match: " << actualInputI16[i] << " vs "
39 void DescribeTo(::std::ostream *os) const override {}