Index

lognestmonster / 03180fa

A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
14525 Nov 2019 18:5703180faUpdate testJosh Stockin14812N

Blob @ lognestmonster / tests / main.c

text/plain2489 bytesdownload raw
1// lognestmonster Copyright (c) 2019 Joshua 'joshuas3' Stockin
2// main.c
3// C file for testing the lognestmonster library header
4
5// <https://github.com/JoshuaS3/lognestmonster/>.
6
7
8// This file is part of lognestmonster.
9
10// lognestmonster is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14
15// lognestmonster is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19
20// You should have received a copy of the GNU General Public License
21// along with lognestmonster. If not, see <https://www.gnu.org/licenses/>.
22
23#include <stdio.h>
24#include "lognestmonster.h"
25
26static char * queueName = "master";
27static char * queuePath = "~/path";
28
29int main(void) {
30 long t1 = lnm_getus();
31
32 printf("lognestmonster C test main()\n");
33 printf("============================\n");
34 printf("\n\n");
35
36
37 printf("data testing\n");
38 printf("----------------------------\n");
39
40 printf("word size/ptr length: %li\n", sizeof(lnmItem));
41 printf("\n");
42
43 printf("enum lnmVerbosityLevel {\n");
44 printf("\tlnmInfo = %d,\n\tlnmDebug = %d,\n\tlnmVerbose = %d,\n\tlnmVeryVerbose = %d,\n\tlnmWarning = %d,\n\tlnmError = %d\n}\n", lnmInfo, lnmDebug, lnmVerbose, lnmVeryVerbose, lnmWarning, lnmError);
45 printf("\n\n");
46
47 printf("core library\n");
48 printf("----------------------------\n");
49
50 printf("creating \"%s\" queue with path \"%s\"\n", queueName, queuePath);
51 lnmQueue queue = lnmQueueInit(queueName, queuePath);
52 printf("queue \"%s\" created at 0x%lx\n", queueName, (long)queue);
53 printf("\n");
54
55 printf("checking queue integrity in registry...\n");
56 printf("queue == lnmQueueByName(\"%s\"): ", queueName);
57 if (queue == lnmQueueByName(queueName)) {
58 printf("true\n");
59 } else {
60 printf("false. exiting...\n");
61 return 1;
62 }
63 printf("\n");
64
65 printf("creating an E{S} logtree\n");
66 lnmEventS(lnmError, "Tag / Invoker", "Test statement pushed to single event with custom tag and message");
67 printf("\n");
68
69 printf("debug registry logtree (1 top level item expected)\n");
70 lnm_debug_parse_registry();
71 printf("\n\n");
72
73 printf("tests finished\n");
74 printf("----------------------------\n");
75 printf("time elapsed (us): %li\n", lnm_getus() - t1);
76
77 return 0;
78}
79