forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestio_glib.c
67 lines (49 loc) · 980 Bytes
/
testio_glib.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @file
*
* @brief Tests for I/O glib binding.
*
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <kdbio.h>
#include <kdbiotest.h>
#include <tests.h>
#include <glib.h>
#include <kdbio/glib.h>
GMainLoop * loop;
GMainContext * context;
typedef struct
{
GSource source;
GPollFD pollFd;
} FdSource;
#define FD_READ_END 0
#define FD_WRITE_END 1
int fds[2];
static ElektraIoInterface * createBinding (void)
{
return elektraIoGlibNew (context);
}
static void startLoop (void)
{
g_main_loop_run (loop);
}
static void stopLoop (void)
{
g_main_loop_quit (loop);
}
int main (int argc, char ** argv)
{
context = NULL;
init (argc, argv);
context = g_main_context_new ();
loop = g_main_loop_new (context, 0);
elektraIoTestSuite (createBinding, startLoop, stopLoop);
print_result ("iowrapper_glib");
g_main_loop_unref (loop);
g_main_context_unref (context);
return nbError;
}