5 #include "test-stuff.h"
7 #include "test-file-stuff.h"
11 #include "sixtp-dom-generators.h"
12 #include "sixtp-dom-parsers.h"
14 #define GNC_V2_STRING "gnc-v2"
15 const gchar *gnc_v2_xml_version_string = GNC_V2_STRING;
18 test_kvp_get_slot(
int run,
20 const gchar *test_key)
23 test_val2 = kvp_frame_get_slot(test_frame1, test_key);
26 success_args(
"kvp_frame_get_slot", __FILE__, __LINE__,
"run=%d", run);
31 failure_args(
"kvp_frame_get_slot", __FILE__, __LINE__,
"run=%d", run);
33 printf(
" Value is %s\n", tmp);
39 test_kvp_copy_compare(
int run,
41 const gchar *test_key)
47 do_test_args(test_frame2 != NULL,
"kvp_frame_copy",
48 __FILE__, __LINE__,
"run=%d", run);
52 success_args(
"kvp_frame_copy->kvp_frame_compare",
53 __FILE__, __LINE__,
"run=%d", run);
58 failure_args(
"kvp_frame_copy->kvp_frame_compare",
59 __FILE__, __LINE__,
"run=%d", run);
61 printf(
"Frame1 is %s\n", tmp);
64 printf(
"Frame2 is %s\n", tmp);
72 test_kvp_copy_get_slot(
int run,
74 const gchar *test_key)
80 test_val2 = kvp_frame_get_slot(test_frame2, test_key);
83 success_args(
"kvp_frame_copy->kvp_frame_get_slot",
84 __FILE__, __LINE__,
"run=%d", run);
89 failure_args(
"kvp_frame_copy->kvp_frame_get_slot",
90 __FILE__, __LINE__,
"run=%d", run);
92 printf(
"Frame1 is %s\n", tmp);
95 printf(
"Frame2 is %s\n", tmp);
102 test_kvp_create_delete(
void)
108 if (test_frame != NULL)
112 success(
"kvp_frame_new");
116 failure(
"kvp_frame_new");
121 test_kvp_frames1(
void)
125 for (i = 0; i < 20; i++)
134 test_key = get_random_string();
138 test_kvp_get_slot(i, test_frame1, test_val1, test_key);
139 test_kvp_copy_compare(i, test_frame1, test_val1, test_key);
140 test_kvp_copy_get_slot(i, test_frame1, test_val1, test_key);
149 test_kvp_printing(
void)
152 for (i = 0; i < 20; i++)
157 ran_frame = get_random_kvp_frame();
169 test_kvp_xml_stuff(
void)
172 for (i = 0; i < 20; i++)
176 xmlNodePtr test_node;
178 test_frame1 = get_random_kvp_frame();
180 test_node = kvp_frame_to_dom_tree(
"test-kvp", test_frame1);
184 failure_args(
"xml stuff", __FILE__, __LINE__,
185 "kvp_frame_to_dom_tree produced NULL");
189 test_frame2 = dom_tree_to_kvp_frame(test_node);
193 success(
"xml stuff");
198 failure(
"xml stuff");
200 printf(
" with kvp_frame 1:\n%s\n", tmp);
202 printf(
" and xml:\n");
203 xmlElemDump(stdout, NULL, test_node);
206 printf(
" and kvp_frame 2:\n%s\n", tmp);
210 xmlFreeNode(test_node);
218 main(
int argc,
char** argv)
221 test_kvp_create_delete();
224 test_kvp_xml_stuff();
225 print_test_results();
void kvp_frame_set_slot(KvpFrame *frame, const gchar *key, KvpValue *value)
gint kvp_frame_compare(const KvpFrame *fa, const KvpFrame *fb)
KvpFrame * kvp_frame_copy(const KvpFrame *frame)
void kvp_frame_delete(KvpFrame *frame)
gchar * kvp_frame_to_string(const KvpFrame *frame)
struct KvpFrameImpl KvpFrame
KvpFrame * kvp_frame_new(void)
void kvp_value_delete(KvpValue *value)
gint kvp_value_compare(const KvpValue *va, const KvpValue *vb)
void qof_init(void)
Initialise the Query Object Framework.
gchar * kvp_value_to_string(const KvpValue *val)
Debug version of kvp_value_to_string.
struct KvpValueImpl KvpValue