mmdeploy/tests/test_csrc/capi/test_model.cpp
lvhan028 3be1779e66
Refactor tests (#283)
* fix sdk model's pipeline.json

* resize INT64 mask

* refactor unit tests

* fix api in model.h

* remove 'customs' from meta info

* fix zip model

* fix clang-format issue

* put tc on each backend into a SECTION

* change SECTION title

* add DYNAMIC_SECTION for capi unit test

* change 'devices' to 'device_names'

* change trt to tensorrt

* remove uncessary check

* add color_type 'color_ignore_orientation' which is used in ocr

* 'min_width', 'max_width' and 'backend' might be null in pipeline config

* fix clang-format issue

* remove useless code
2021-12-17 19:57:37 +08:00

32 lines
885 B
C++

// Copyright (c) OpenMMLab. All rights reserved.
// clang-format off
#include "catch.hpp"
// clang-format on
#include "apis/c/model.h"
#include "test_resource.h"
TEST_CASE("test model c capi", "[model]") {
auto &gResource = MMDeployTestResources::Get();
std::string model_path;
for (auto const &codebase : gResource.codebases()) {
for (auto const &backend : gResource.backends()) {
if (auto _model_list = gResource.LocateModelResources(codebase + "/" + backend);
!_model_list.empty()) {
model_path = _model_list.front();
break;
}
}
}
REQUIRE(!model_path.empty());
mm_model_t model{};
REQUIRE(mmdeploy_model_create_by_path(model_path.c_str(), &model) == MM_SUCCESS);
mmdeploy_model_destroy(model);
model = nullptr;
REQUIRE(mmdeploy_model_create(nullptr, 0, &model) == MM_E_FAIL);
mmdeploy_model_destroy(model);
}