Publishing 2019 R1.1 content and Myriad plugin sources (#162)
[platform/upstream/dldt.git] / inference-engine / tests / unit / engines / gna / gna_aminteldnn_test.cpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #include <gtest/gtest.h>
6 #include "gna_matcher.hpp"
7 #include "inference_engine.hpp"
8 #include "dnn.h"
9
10 using namespace testing;
11 using namespace InferenceEngine;
12
13 class GNA_AmIntelDnn_test : public GNATest {
14 protected:
15     AmIntelDnn amIntelDnn;
16     intel_nnet_type_t  desc = {};
17 };
18
19 TEST_F(GNA_AmIntelDnn_test, intel_nnet_type_tDoesNotFreeHisMemory) {
20     desc.pLayers = nullptr;
21     amIntelDnn.component.resize(1);
22     amIntelDnn.component[0].operation = kDnnAffineOp;
23     ASSERT_NO_THROW(amIntelDnn.InitGNAStruct(&desc));  // thirst init is ok
24     ASSERT_THROW(amIntelDnn.InitGNAStruct(&desc), InferenceEngine::details::InferenceEngineException);  // second init involves memory leak
25 }
26
27 TEST_F(GNA_AmIntelDnn_test, intel_nnet_type_t_ptrIsNullptr) {
28     ASSERT_THROW(amIntelDnn.InitGNAStruct(nullptr), InferenceEngine::details::InferenceEngineException);
29 }
30
31 TEST_F(GNA_AmIntelDnn_test, intel_nnet_type_t_pLayersIsNotNullptr) {
32     ASSERT_THROW(amIntelDnn.InitGNAStruct(&desc), InferenceEngine::details::InferenceEngineException);
33 }
34
35 TEST_F(GNA_AmIntelDnn_test, ComponentIsEmpty) {
36     desc.pLayers = nullptr;
37     ASSERT_THROW(amIntelDnn.InitGNAStruct(&desc), InferenceEngine::details::InferenceEngineException);
38 }