Replace () with (void) in function prototypes
[platform/core/system/dlog.git] / src / tests / libdlog_android_neg.c
1 /*
2  * Copyright (c) 2018-2020, Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 "libdlog_android_wrapper.c"
18
19 int main(void)
20 {
21         fail_open = true;
22         __dlog_init_android(&CONF);
23         assert(closed == 2);
24         assert(!write_to_log);
25         assert(!destroy_backend);
26         closed = 0;
27
28         fail_open = false;
29         __dlog_init_android(&CONF);
30         assert(closed == 0);
31         assert(write_to_log);
32         assert(destroy_backend);
33
34         struct timespec tp;
35         int result = clock_gettime(CLOCK_MONOTONIC, &tp);
36         if (result < 0)
37                 return EXIT_FAILURE;
38
39 #define F(B, P, M) assert(write_to_log(B, P, "tag", M, &tp) == DLOG_ERROR_INVALID_PARAMETER)
40         F(LOG_ID_INVALID, DLOG_ERROR       , "xx");
41         F(LOG_ID_MAX    , DLOG_ERROR       , "xx");
42         F(LOG_ID_MAIN   , DLOG_UNKNOWN     , "xx");
43         F(LOG_ID_MAIN   , (log_priority) -7, "xx");
44         F(LOG_ID_MAIN   , (log_priority) 23, "xx");
45         F(LOG_ID_MAIN   , DLOG_ERROR       , NULL);
46 #undef F
47
48         used_tag = "tag";
49         for (int i = 0; i < 4; ++i) {
50                 used_msg = LONG_TEXTS[i];
51
52                 writev_called = false;
53                 writev_ret = -1;
54                 errno_to_set = i + 10;
55                 assert(write_to_log(i, i + 3, "tag", LONG_TEXTS[i], &tp) == -(i + 10));
56                 assert(writev_called);
57         }
58
59         destroy_backend();
60         assert(closed + 1 == LOG_ID_MAX);
61 }