Files
openvino/inference-engine/tests_deprecated/unit/inference_engine_tests/preprocess_test.cpp

54 lines
1.7 KiB
C++
Raw Normal View History

2020-02-11 22:48:49 +03:00
// Copyright (C) 2018-2020 Intel Corporation
2018-10-16 13:45:03 +03:00
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include <ie_preprocess.hpp>
using namespace std;
class PreProcessTests : public ::testing::Test {
protected:
virtual void TearDown() {
}
virtual void SetUp() {
}
public:
};
TEST_F(PreProcessTests, throwsOnSettingNullMeanImage) {
InferenceEngine::PreProcessInfo info;
info.init(1);
ASSERT_THROW(info.setMeanImage(InferenceEngine::Blob::Ptr(nullptr)),
InferenceEngine::details::InferenceEngineException);
}
TEST_F(PreProcessTests, throwsOnSetting2DMeanImage) {
InferenceEngine::PreProcessInfo info;
info.init(1);
2019-08-09 19:02:42 +03:00
InferenceEngine::Blob::Ptr blob(new InferenceEngine::TBlob<float>({ InferenceEngine::Precision::FP32,
{1, 1}, InferenceEngine::Layout::HW}));
2018-10-16 13:45:03 +03:00
ASSERT_THROW(info.setMeanImage(blob), InferenceEngine::details::InferenceEngineException);
}
TEST_F(PreProcessTests, throwsOnSettingWrongSizeMeanImage) {
InferenceEngine::PreProcessInfo info;
info.init(1);
2019-08-09 19:02:42 +03:00
InferenceEngine::TBlob<float>::Ptr blob(new InferenceEngine::TBlob<float>({ InferenceEngine::Precision::FP32,
{ 2, 1, 1 }, InferenceEngine::Layout::CHW }));
2020-02-11 22:48:49 +03:00
blob->allocate();
2018-10-16 13:45:03 +03:00
ASSERT_THROW(info.setMeanImage(blob), InferenceEngine::details::InferenceEngineException);
}
TEST_F(PreProcessTests, noThrowWithCorrectSizeMeanImage) {
InferenceEngine::PreProcessInfo info;
info.init(2);
2019-08-09 19:02:42 +03:00
InferenceEngine::TBlob<float>::Ptr blob(new InferenceEngine::TBlob<float>({ InferenceEngine::Precision::FP32,
{ 2, 1, 1 }, InferenceEngine::Layout::CHW }));
2020-02-11 22:48:49 +03:00
blob->allocate();
2018-10-16 13:45:03 +03:00
ASSERT_NO_THROW(info.setMeanImage(blob));
}