| 31 |
31 |
| 32 #include <dbutils/dbutils.h> |
32 #include <dbutils/dbutils.h> |
| 33 #include <dbutils/sqlite.h> |
33 #include <dbutils/sqlite.h> |
| 34 #include <dbutils/db.h> |
34 #include <dbutils/db.h> |
| 35 |
35 |
| |
36 #include <cx/test.h> |
| 36 #include <cx/buffer.h> |
37 #include <cx/buffer.h> |
| 37 #include <cx/printf.h> |
38 #include <cx/printf.h> |
| |
39 |
| |
40 #include "database.h" |
| 38 |
41 |
| 39 const char *sql_create_table_person = |
42 const char *sql_create_table_person = |
| 40 "create table if not exists Person (" |
43 "create table if not exists Person (" |
| 41 "person_id integer primary key autoincrement, " |
44 "person_id integer primary key autoincrement, " |
| 42 "name text, " |
45 "name text, " |
| 113 |
116 |
| 114 |
117 |
| 115 static int create_test_data(sqlite3 *db); |
118 static int create_test_data(sqlite3 *db); |
| 116 |
119 |
| 117 int main(int argc, char **argv) { |
120 int main(int argc, char **argv) { |
| 118 |
121 CxTestSuite *suite = cx_test_suite_new("dbu"); |
| |
122 |
| |
123 #ifdef DBU_SQLITE |
| |
124 if(init_test_db() || init_db_tests()) { |
| |
125 return 1; |
| |
126 } |
| |
127 |
| |
128 cx_test_register(suite, testSqliteConnection); |
| |
129 cx_test_register(suite, testConnectionExec); |
| |
130 cx_test_register(suite, testSingleValueQuery); |
| |
131 #endif |
| |
132 |
| |
133 cx_test_run_stdout(suite); |
| |
134 |
| |
135 |
| |
136 #ifdef DBU_SQLITE |
| |
137 cleanup_db_tests(); |
| |
138 #endif |
| |
139 |
| |
140 /* |
| 119 |
141 |
| 120 DBUContext *ctx = dbuContextCreate(); |
142 DBUContext *ctx = dbuContextCreate(); |
| 121 |
143 |
| 122 DBUClass *address = dbuRegisterClass(ctx, "address", Address, address_id); |
144 DBUClass *address = dbuRegisterClass(ctx, "address", Address, address_id); |
| 123 dbuClassAdd(address, Address, street); |
145 dbuClassAdd(address, Address, street); |