Replace () with (void) in function prototypes
[platform/core/system/dlog.git] / src / tests / logutil_neg.c
1 /*
2  * Copyright (c) 2019-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 "logutil_wrap.c"
18
19 int main(void)
20 {
21         struct sort_vector sv;
22         sort_vector_init(&sv);
23         sv.sort_by = DLOGUTIL_SORT_SENT_MONO;
24         sv.timeout = 60;
25         sv.size = DEFAULT_SORT_BUFFER_SIZE;
26         sort_vector_finalize(&sv);
27         assert(sort_vector_time_span(&sv, (struct timespec) { .tv_nsec = -1 }) == 0);
28
29         struct fd_ops test_ops = {
30                 .has_log = test_has_log,
31                 .peek_entry = test_peek_entry,
32         };
33
34         struct fd_info fd_stor[10] = {};
35         struct fdi_internal ii_stor[10] = {};
36         dlogutil_entry_s ent_stor[10 - 3] = {};
37         for (int i = 0; i < 10; ++i) {
38                 if (i < 3)
39                         ii_stor[i].has_log = false;
40                 else {
41                         ent_stor[i - 3].sec_sent_mono = i % 2;
42                         ent_stor[i - 3].nsec_sent_mono = i;
43
44                         ii_stor[i].has_log = true;
45                         ii_stor[i].ent = &ent_stor[i - 3];
46                 }
47
48                 int t = i * 3 % 10;
49                 fd_stor[i].ops = &test_ops;
50                 fd_stor[i].priv_data = &ii_stor[t];
51         }
52
53         struct fd_info *fds[10] = {};
54         for (int i = 0; i < 10; ++i) {
55                 fds[i] = &fd_stor[i];
56         }
57
58         dlogutil_entry_s *vector_overflown = NULL;
59         bool need_epoll = false, all_drained = false;
60         fdi_push_log_ret = -EIO;
61         assert(put_logs_into_vector(fds, 10, &sv, (struct log_filter *)0xEEE, false, &need_epoll, &all_drained, &vector_overflown) == -EIO);
62         assert(!vector_overflown);
63
64         sort_vector_free(&sv);
65 }