5 * Copyright (C) 2018-2019 Intel Corporation.
7 * The source code contained or described herein and all documents
8 * related to the source code ("Material") are owned by Intel Corporation
9 * or its suppliers or licensors. Title to the Material remains with
10 * Intel Corporation or its suppliers and licensors. The Material may
11 * contain trade secrets and proprietary and confidential information
12 * of Intel Corporation and its suppliers and licensors, and is protected
13 * by worldwide copyright and trade secret laws and treaty provisions.
14 * No part of the Material may be used, copied, reproduced, modified,
15 * published, uploaded, posted, transmitted, distributed, or disclosed
16 * in any way without Intel's prior express written permission.
18 * No license under any patent, copyright, trade secret or other
19 * intellectual property right is granted to or conferred upon you by
20 * disclosure or delivery of the Materials, either expressly, by implication,
21 * inducement, estoppel or otherwise. Any license under such intellectual
22 * property rights must be express and approved by Intel in writing.
24 * Include any supplier copyright notices as supplier requires Intel to use.
26 * Include supplier trademarks or logos as supplier requires Intel to use,
27 * preceded by an asterisk. An asterisked footnote can be added as follows:
28 * *Third Party trademarks are the property of their respective owners.
30 * Unless otherwise agreed by Intel in writing, you may not remove or alter
31 * this notice or any other notice embedded in Materials by Intel or Intel's
32 * suppliers or licensors in any way.
37 #include <gmock/gmock-matchers.h>
38 #include "nnet_base_matcher.hpp"
40 class InputDataMatcher : public ::testing::MatcherInterface<const intel_nnet_type_t *> {
41 std::vector<int16_t> refInput;
44 explicit InputDataMatcher(const std::vector<int16_t> &_refInput) : refInput(_refInput) {}
46 bool MatchAndExplain(const intel_nnet_type_t *foo, ::testing::MatchResultListener *listener) const override {
47 if (foo->pLayers == nullptr) {
48 *listener << "Address of the first layer descriptor is NULL";
51 auto firstLayer = foo->pLayers[0];
52 auto actualInput = firstLayer.pInputs;
54 *listener << "Input of the first layer is NULL";
58 auto *actualInputI16 = reinterpret_cast<int16_t *>(actualInput);
59 for (int i = 0; i < refInput.size(); i++) {
60 if (actualInputI16[i] != refInput[i]) {
61 *listener << "Actual and reference value of input doesn't match: " << actualInputI16[i] << " vs "
68 void DescribeTo(::std::ostream *os) const override {}