1be168c0dSopenharmony_ci/* 2be168c0dSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3be168c0dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4be168c0dSopenharmony_ci * you may not use this file except in compliance with the License. 5be168c0dSopenharmony_ci * You may obtain a copy of the License at 6be168c0dSopenharmony_ci * 7be168c0dSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8be168c0dSopenharmony_ci * 9be168c0dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10be168c0dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11be168c0dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12be168c0dSopenharmony_ci * See the License for the specific language governing permissions and 13be168c0dSopenharmony_ci * limitations under the License. 14be168c0dSopenharmony_ci */ 15be168c0dSopenharmony_ci 16be168c0dSopenharmony_ci#include <inttypes.h> 17be168c0dSopenharmony_ci#include <securec.h> 18be168c0dSopenharmony_ci#include "gtest/gtest.h" 19be168c0dSopenharmony_ci#include "include/c_api/context_c.h" 20be168c0dSopenharmony_ci#include "include/c_api/model_c.h" 21be168c0dSopenharmony_ci#include "include/c_api/types_c.h" 22be168c0dSopenharmony_ci#include "include/c_api/status_c.h" 23be168c0dSopenharmony_ci#include "include/c_api/data_type_c.h" 24be168c0dSopenharmony_ci#include "include/c_api/tensor_c.h" 25be168c0dSopenharmony_ci#include "include/c_api/format_c.h" 26be168c0dSopenharmony_ci#include "../utils/common.h" 27be168c0dSopenharmony_ci#include "../utils/model_utils.h" 28be168c0dSopenharmony_ci 29be168c0dSopenharmony_ciclass MSLiteTest: public testing::Test { 30be168c0dSopenharmony_ciprotected: 31be168c0dSopenharmony_ci static void SetUpTestCase(void) {} 32be168c0dSopenharmony_ci static void TearDownTestCase(void) {} 33be168c0dSopenharmony_ci virtual void SetUp() {} 34be168c0dSopenharmony_ci virtual void TearDown() {} 35be168c0dSopenharmony_ci}; 36be168c0dSopenharmony_ci 37be168c0dSopenharmony_ci/* 38be168c0dSopenharmony_ci * @tc.name: end_to_end_0001 39be168c0dSopenharmony_ci * @tc.desc: Test MindSpore Runtime. 40be168c0dSopenharmony_ci * @tc.type: FUNC 41be168c0dSopenharmony_ci */ 42be168c0dSopenharmony_ciHWTEST(MSLiteTest, end_to_end_0001, testing::ext::TestSize.Level0) { 43be168c0dSopenharmony_ci printf("==========Init Context==========\n"); 44be168c0dSopenharmony_ci OH_AI_ContextHandle context = OH_AI_ContextCreate(); 45be168c0dSopenharmony_ci ASSERT_NE(context, nullptr); 46be168c0dSopenharmony_ci 47be168c0dSopenharmony_ci AddContextDeviceCPU(context); 48be168c0dSopenharmony_ci 49be168c0dSopenharmony_ci printf("==========Create model==========\n"); 50be168c0dSopenharmony_ci OH_AI_ModelHandle model = OH_AI_ModelCreate(); 51be168c0dSopenharmony_ci ASSERT_NE(model, nullptr); 52be168c0dSopenharmony_ci 53be168c0dSopenharmony_ci ModelPredict(model, context, "ml_face_isface", {}, false, true, false); 54be168c0dSopenharmony_ci}