43 #include "CUnit/Basic.h" 58 static void TestDqsBasic(
void)
65 CU_ASSERT_STRING_EQUAL(sql,
"SELECT * FROM TEST");
71 CU_ASSERT_STRING_EQUAL(sql,
"SELECT COUNT(*) FROM TEST");
85 static void TestDqsConditionInt(
void)
99 CU_ASSERT_STRING_EQUAL(sql,
100 "SELECT COUNT(*) FROM TEST WHERE ALPHA < 1 AND BETA <= 2 AND GAMMA = 3 " 101 "AND DELTA != 4 AND EPSILON >= 5 AND ZETA > 6");
115 static void TestDqsConditionString(
void)
119 static const char* TEST =
120 "SELECT * FROM TEST WHERE ALPHA < 'PETER' AND BETA <= 'PIPER' " 121 "AND GAMMA = 'PICKED' AND DELTA != 'A' AND EPSILON >= 'PECK' " 133 CU_ASSERT_STRING_EQUAL(sql, TEST);
148 static void TestDqsConditionKeyword(
void)
152 static const char* TEST =
153 "SELECT * FROM TEST WHERE ALPHA IN (1, 2, 3) " 154 "AND BETA IN (\"ALEPH\", \"BETH\")";
162 CU_ASSERT_STRING_EQUAL(sql, TEST);
177 static void TestDqsOrderBy(
void)
181 static const char* TEST =
182 "SELECT * FROM TEST WHERE ALPHA IN (1, 2, 3) ORDER BY BETA";
189 CU_ASSERT_STRING_EQUAL(sql, TEST);
215 {
"TestDqsBasic", TestDqsBasic},
216 {
"TestDqsConditionInt", TestDqsConditionInt},
217 {
"TestDqsConditionString", TestDqsConditionString},
218 {
"TestDqsConditionKeyword", TestDqsConditionKeyword},
219 {
"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)