OpenDNSSEC-enforcer
1.3.9
Main Page
Data Structures
Files
File List
Globals
enforcer
test
cunit
test_di_string.c
Go to the documentation of this file.
1
/*
2
* $Id: test_di_string.c 3811 2010-08-26 15:05:19Z jakob $
3
*
4
* Copyright (c) 2008-2009 Nominet UK. All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*
27
*/
28
29
/*+
30
* Filename: test_di_string.c - Test di_string
31
*
32
* Description:
33
* This is a short test module to check the functions in the code that
34
* constructs an INSERT statement.
35
*
36
* The test program makes use of the CUnit framework, as described in
37
* http://cunit.sourceforge.net
38
-*/
39
40
#include <stdlib.h>
41
#include <stdio.h>
42
#include <string.h>
43
#include <time.h>
44
45
#include "CUnit/Basic.h"
46
47
#include "
ksm/database_statement.h
"
48
#include "
test_routines.h
"
49
50
51
52
/*+
53
* TestDisCreate - Test Dis Routines
54
*
55
* Description:
56
* Constructs a database INSERT statement and checks the string so
57
* constructed.
58
-*/
59
60
static
void
TestDisCreate(
void
)
61
{
62
char
* sql = NULL;
63
64
static
const
char
* TEST =
65
"INSERT INTO TEST VALUES (NULL, 1, 'ALPHA', NULL)"
;
66
67
sql =
DisInit
(
"TEST"
);
68
DisAppendInt
(&sql, 1);
69
DisAppendString
(&sql,
"ALPHA"
);
70
DisAppendString
(&sql, NULL);
71
DisEnd
(&sql);
72
73
CU_ASSERT_STRING_EQUAL(sql, TEST);
74
DisFree
(sql);
75
76
return
;
77
}
78
79
80
/*+
81
* TestDis - Create Test Suite
82
*
83
* Description:
84
* Adds the test suite to the CUnit test registry and adds all the tests
85
* to it.
86
*
87
* Arguments:
88
* None.
89
*
90
* Returns:
91
* int
92
* Return status. 0 => Success.
93
*/
94
95
int
TestDis
(
void
);
/* Declaration */
96
int
TestDis
(
void
)
97
{
98
struct
test_testdef
tests[] = {
99
{
"TestDisCreate"
, TestDisCreate},
100
{NULL, NULL}
101
};
102
103
return
TcuCreateSuite
(
"Dis"
, NULL, NULL, tests);
104
}
Generated on Thu Mar 20 2014 15:30:05 for OpenDNSSEC-enforcer by
1.8.1.2