884e4df2c722efddcd1efa3e5ee720f4cbee310a
[framework/messaging/msg-service.git] / TC / msgTC / MapiMessage / utc_msg_set_time.c
1  /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   *
4   * Licensed under the Flora License, Version 1.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *    http://www.tizenopensource.org/license
9   *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16
17 #include "utc_msg_set_time.h"
18
19 static MSG_HANDLE_T msgHandle = NULL;
20 msg_message_t msgInfo;
21
22 void startup(void)
23 {
24         MSG_ERROR_T err = MSG_SUCCESS;
25
26         err = msg_open_msg_handle(&msgHandle);
27         if (err != MSG_SUCCESS)
28         {
29                 tet_result(TET_FAIL);
30                 return;
31         }
32
33         msgInfo = msg_new_message();
34 }
35 void cleanup(void)
36 {
37         msg_close_msg_handle(&msgHandle);
38 }
39
40 void utc_msg_set_time_001()
41 {
42         MSG_ERROR_T err = MSG_SUCCESS;
43
44         time_t curTime = time(NULL);
45
46         err = msg_set_time(msgInfo, curTime);
47         if (err != MSG_SUCCESS)
48         {
49                 tet_result(TET_FAIL);
50                 return;
51         }
52
53         tet_result(TET_PASS);
54 }
55
56 void utc_msg_set_time_002()
57 {
58         MSG_ERROR_T err = MSG_SUCCESS;
59
60         time_t curTime = time(NULL);
61
62         err = msg_set_time(NULL, curTime);
63         if (err != MSG_SUCCESS)
64         {
65                 tet_result(TET_PASS);
66                 return;
67         }
68
69         tet_result(TET_FAIL);
70 }