1 /*
2 * Copyright (c) 2021 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 <fmtmsg.h>
17
18 #include "gtest/gtest.h"
19 #include "log.h"
20 #include "utils.h"
21
22 using namespace testing::ext;
23
24 class ActsUtilMsgApiTest : public testing::Test {
25 protected:
26 // SetUpTestCase: Testsuit setup, run before 1st testcase
SetUpTestCase(void)27 static void SetUpTestCase(void)
28 {
29 }
30 // TearDownTestCase: Testsuit teardown, run after last testcase
TearDownTestCase(void)31 static void TearDownTestCase(void)
32 {
33 }
34 // Testcase setup
SetUp()35 virtual void SetUp()
36 {
37 }
38 // Testcase teardown
TearDown()39 virtual void TearDown()
40 {
41 }
42 };
43
44 /**
45 * @tc.number SUB_KERNEL_UTIL_MSG_FMTMSG_0100
46 * @tc.name test fmtmsg api
47 * @tc.desc [C- SOFTWARE -0200]
48 */
HWTEST_F(ActsUtilMsgApiTest, testFmtmsg0100, Function | MediumTest | Level1)49 HWTEST_F(ActsUtilMsgApiTest, testFmtmsg0100, Function | MediumTest | Level1) {
50 int returnVal = 0;
51
52 returnVal = fmtmsg(MM_PRINT, "test fmtmsg:", MM_INFO, "hello fmtmsg", "call it", "fmtmsg");
53 LOGD(" fmtmsg returnVal:='%d'\n", returnVal);
54 ASSERT_TRUE(MM_OK == returnVal) << "ErrInfo: fmtmsg returnVal:='" << returnVal << "'";
55 }