Git init
[pkgs/e/elektra.git] / tests / test_internals.c
1 /*************************************************************************** 
2  *           test_split.c  - Test suite for splitted keyset data structure
3  *                  -------------------
4  *  begin                : Fri 21 Mar 2008
5  *  copyright            : (C) 2008 by Markus Raab
6  *  email                : elektra@markus-raab.org
7  ****************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the BSD License (revised).                      *
13  *                                                                         *
14  ***************************************************************************/
15
16 #ifdef HAVE_CONFIG_H
17 #include "config.h"
18 #endif
19
20 #include <stdio.h>
21 #ifdef HAVE_STDLIB_H
22 #include <stdlib.h>
23 #endif
24 #ifdef HAVE_STRING_H
25 #include <string.h>
26 #endif
27
28 #include <tests.h>
29
30 /*Needs private declarations*/
31 #include <kdbbackend.h>
32
33 void test_strlen ()
34 {
35         wchar_t multicharSeq [5];
36
37         printf ("Test kdbiStrLen\n");
38         multicharSeq [0] = '\323';
39         multicharSeq [1] = L'a';
40         multicharSeq [2] = L'\20';
41         multicharSeq [3] = L'\40';
42         multicharSeq [4] = L'\0';
43
44         // printf ("%s %d %d\n", multicharSeq, kdbiStrLen (multicharSeq), strlen(multicharSeq));
45         succeed_if(kdbiStrLen ((char*)multicharSeq) == 6, "could not deduce correct multichar sequence length");
46 }
47
48 int test_load_toolslib()
49 {
50         KeySet          *ks = ksNew (0);
51
52         exit_if_fail (loadToolsLib()==0, "Unable to load elektratools");
53         exit_if_fail( ksFromXMLfile(ks, "key.xml") == 0, "ksFromXMLfile(key.xml) failed.");
54         ksGenerate (ks, stdout, KDB_O_HEADER);
55
56         ksDel (ks);
57         return 0;
58 }
59
60 int main()
61 {
62         printf("INTERNALS    TESTS\n");
63         printf("==================\n\n");
64
65         init ();
66
67         test_strlen();
68         // test_load_toolslib();
69
70         printf("\ntest_internals RESULTS: %d test(s) done. %d error(s).\n", nbTest, nbError);
71
72         return nbError;
73 }
74