3535
3636#define UPDATE_DATA_1 "UPDATE test_table SET string_col='new value1' WHERE integer_col = 1"
3737
38- const char * db_path ;
39-
4038void print_result (struct _h_result result ) {
4139 size_t col , row , i ;
4240 printf ("rows: %u, col: %u\n" , result .nb_rows , result .nb_columns );
@@ -72,7 +70,7 @@ void print_result(struct _h_result result) {
7270START_TEST (test_hoel_init )
7371{
7472 struct _h_connection * conn ;
75- conn = h_connect_sqlite (db_path );
73+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
7674 ck_assert_ptr_ne (conn , NULL );
7775 ck_assert_ptr_eq (h_connect_sqlite (WRONG_BD_PATH ), NULL );
7876 ck_assert_int_eq (h_close_db (conn ), H_OK );
@@ -89,7 +87,7 @@ START_TEST(test_hoel_escape_string)
8987 json_t * j_query , * j_result ;
9088 int res ;
9189
92- conn = h_connect_sqlite (db_path );
90+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
9391 ck_assert_ptr_ne (conn , NULL );
9492 escaped = h_escape_string (conn , "value" );
9593 ck_assert_str_eq (escaped , "value" );
@@ -121,7 +119,7 @@ START_TEST(test_hoel_escape_string_with_quotes)
121119 json_t * j_query , * j_result ;
122120 int res ;
123121
124- conn = h_connect_sqlite (db_path );
122+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
125123 ck_assert_ptr_ne (conn , NULL );
126124 escaped = h_escape_string_with_quotes (conn , "value" );
127125 ck_assert_str_eq (escaped , "'value'" );
@@ -151,7 +149,7 @@ START_TEST(test_hoel_insert)
151149 struct _h_connection * conn ;
152150 struct _h_result result ;
153151 struct _h_data * last_id ;
154- conn = h_connect_sqlite (db_path );
152+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
155153 ck_assert_ptr_ne (conn , NULL );
156154 ck_assert_int_eq (h_query_delete (conn , DELETE_DATA_ALL ), H_OK );
157155 ck_assert_int_eq (h_query_insert (conn , INSERT_DATA_1 ), H_OK );
@@ -184,7 +182,7 @@ START_TEST(test_hoel_update)
184182{
185183 struct _h_connection * conn ;
186184 struct _h_result result ;
187- conn = h_connect_sqlite (db_path );
185+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
188186 ck_assert_ptr_ne (conn , NULL );
189187 ck_assert_int_eq (h_query_insert (conn , INSERT_DATA_1 ), H_OK );
190188 ck_assert_int_eq (h_query_insert (conn , NULL ), H_ERROR_PARAMS );
@@ -211,7 +209,7 @@ START_TEST(test_hoel_delete)
211209{
212210 struct _h_connection * conn ;
213211 struct _h_result result ;
214- conn = h_connect_sqlite (db_path );
212+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
215213 ck_assert_ptr_ne (conn , NULL );
216214 ck_assert_int_eq (h_query_insert (conn , INSERT_DATA_1 ), H_OK );
217215 ck_assert_int_eq (h_query_insert (conn , INSERT_DATA_2 ), H_OK );
@@ -259,7 +257,7 @@ START_TEST(test_hoel_json_insert)
259257 "date_col" ,
260258 "raw" ,
261259 "date('now')" ), * j_result = NULL ;
262- conn = h_connect_sqlite (db_path );
260+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
263261 ck_assert_ptr_ne (conn , NULL );
264262 ck_assert_int_eq (h_insert (conn , j_query , & str_query ), H_OK );
265263 json_decref (j_query );
@@ -301,7 +299,7 @@ START_TEST(test_hoel_json_update)
301299 "raw" ,
302300 "date('now')" ),
303301 * j_result = NULL ;
304- conn = h_connect_sqlite (db_path );
302+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
305303 ck_assert_ptr_ne (conn , NULL );
306304 ck_assert_int_eq (h_insert (conn , j_query , NULL ), H_OK );
307305 json_decref (j_query );
@@ -367,7 +365,7 @@ START_TEST(test_hoel_json_delete)
367365 "raw" ,
368366 "date('now')" ),
369367 * j_result = NULL ;
370- conn = h_connect_sqlite (db_path );
368+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
371369 ck_assert_ptr_ne (conn , NULL );
372370 ck_assert_int_eq (h_insert (conn , j_query , NULL ), H_OK );
373371 json_decref (j_query );
@@ -442,7 +440,7 @@ START_TEST(test_hoel_json_select)
442440 "raw" ,
443441 "date('now')" ),
444442 * j_result = NULL ;
445- conn = h_connect_sqlite (db_path );
443+ conn = h_connect_sqlite (DEFAULT_BD_PATH );
446444 ck_assert_ptr_ne (conn , NULL );
447445 ck_assert_int_eq (h_insert (conn , j_query , NULL ), H_OK );
448446 json_decref (j_query );
@@ -642,11 +640,7 @@ int main(int argc, char *argv[])
642640 Suite * s ;
643641 SRunner * sr ;
644642 //y_init_logs("Hoel", Y_LOG_MODE_CONSOLE, Y_LOG_LEVEL_DEBUG, NULL, "Starting Hoel core tests");
645- if (argc > 1 ) {
646- db_path = argv [1 ];
647- } else {
648- db_path = DEFAULT_BD_PATH ;
649- }
643+
650644 s = hoel_suite ();
651645 sr = srunner_create (s );
652646
0 commit comments