1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
5 #include <gtest/gtest.h>
6 #include "gna_matcher.hpp"
7 #include "inference_engine.hpp"
10 using namespace testing;
11 using namespace InferenceEngine;
13 class GNA_AmIntelDnn_test : public GNATest {
15 AmIntelDnn amIntelDnn;
16 intel_nnet_type_t desc = {};
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
27 TEST_F(GNA_AmIntelDnn_test, intel_nnet_type_t_ptrIsNullptr) {
28 ASSERT_THROW(amIntelDnn.InitGNAStruct(nullptr), InferenceEngine::details::InferenceEngineException);
31 TEST_F(GNA_AmIntelDnn_test, intel_nnet_type_t_pLayersIsNotNullptr) {
32 ASSERT_THROW(amIntelDnn.InitGNAStruct(&desc), InferenceEngine::details::InferenceEngineException);
35 TEST_F(GNA_AmIntelDnn_test, ComponentIsEmpty) {
36 desc.pLayers = nullptr;
37 ASSERT_THROW(amIntelDnn.InitGNAStruct(&desc), InferenceEngine::details::InferenceEngineException);