45 #include "CUnit/Basic.h"
60 static void TestDqsBasic(
void)
67 CU_ASSERT_STRING_EQUAL(sql,
"SELECT * FROM TEST");
73 CU_ASSERT_STRING_EQUAL(sql,
"SELECT COUNT(*) FROM TEST");
87 static void TestDqsConditionInt(
void)
101 CU_ASSERT_STRING_EQUAL(sql,
102 "SELECT COUNT(*) FROM TEST WHERE ALPHA < 1 AND BETA <= 2 AND GAMMA = 3 "
103 "AND DELTA != 4 AND EPSILON >= 5 AND ZETA > 6");
117 static void TestDqsConditionString(
void)
121 static const char* TEST =
122 "SELECT * FROM TEST WHERE ALPHA < 'PETER' AND BETA <= 'PIPER' "
123 "AND GAMMA = 'PICKED' AND DELTA != 'A' AND EPSILON >= 'PECK' "
135 CU_ASSERT_STRING_EQUAL(sql, TEST);
150 static void TestDqsConditionKeyword(
void)
154 static const char* TEST =
155 "SELECT * FROM TEST WHERE ALPHA IN (1, 2, 3) "
156 "AND BETA IN (\"ALEPH\", \"BETH\")";
164 CU_ASSERT_STRING_EQUAL(sql, TEST);
179 static void TestDqsOrderBy(
void)
183 static const char* TEST =
184 "SELECT * FROM TEST WHERE ALPHA IN (1, 2, 3) ORDER BY BETA";
191 CU_ASSERT_STRING_EQUAL(sql, TEST);
217 {
"TestDqsBasic", TestDqsBasic},
218 {
"TestDqsConditionInt", TestDqsConditionInt},
219 {
"TestDqsConditionString", TestDqsConditionString},
220 {
"TestDqsConditionKeyword", TestDqsConditionKeyword},
221 {
"TestDqsOrderBy", TestDqsOrderBy},
int TcuCreateSuite(const char *title, int(*init)(), int(*teardown)(), struct test_testdef *tests)
void DqsConditionKeyword(char **query, const char *field, DQS_COMPARISON compare, const char *value, int index)
void DqsOrderBy(char **query, const char *field)
void DqsFree(char *query)
char * DqsCountInit(const char *table)
void DqsConditionInt(char **query, const char *field, DQS_COMPARISON compare, int value, int index)
char * DqsInit(const char *table)
void DqsEnd(char **query)
void DqsConditionString(char **query, const char *field, DQS_COMPARISON compare, const char *value, int index)