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