Kouhei Sutou
null+****@clear*****
Tue Mar 10 15:33:18 JST 2015
Kouhei Sutou 2015-03-10 15:33:18 +0900 (Tue, 10 Mar 2015) New Revision: 8a762665083fad3251608fad56f55e84a4cab14e https://github.com/groonga/groonga/commit/8a762665083fad3251608fad56f55e84a4cab14e Message: test: add tests for grn_operator_exec_less() Modified files: test/unit/core/test-operator.c Modified: test/unit/core/test-operator.c (+68 -0) =================================================================== --- test/unit/core/test-operator.c 2015-03-10 15:30:53 +0900 (5d77c0d) +++ test/unit/core/test-operator.c 2015-03-10 15:33:18 +0900 (31aad2b) @@ -33,6 +33,10 @@ void data_exec_not_equal_true(void); void test_exec_not_equal_true(gconstpointer data); void data_exec_not_equal_false(void); void test_exec_not_equal_false(gconstpointer data); +void data_exec_less_true(void); +void test_exec_less_true(gconstpointer data); +void data_exec_less_false(void); +void test_exec_less_false(gconstpointer data); static gchar *tmp_directory; @@ -240,3 +244,67 @@ test_exec_not_equal_false(gconstpointer data) cut_assert_false(grn_operator_exec_not_equal(context, &lhs, &rhs)); } + +void +data_exec_less_true(void) +{ +#define ADD_DATA(lhs_type, rhs_type) \ + gcut_add_datum(lhs_type " < " rhs_type, \ + "lhs_type", G_TYPE_STRING, lhs_type, \ + "rhs_type", G_TYPE_STRING, rhs_type, \ + NULL) + + ADD_DATA("int32", "int32"); + ADD_DATA("text", "text"); + ADD_DATA("text", "int32"); + ADD_DATA("int32", "text"); + +#undef ADD_DATA +} + +void +test_exec_less_true(gconstpointer data) +{ + const gchar *lhs_type; + const gchar *rhs_type; + + lhs_type = gcut_data_get_string(data, "lhs_type"); + rhs_type = gcut_data_get_string(data, "rhs_type"); + + set_one(&lhs, lhs_type); + set_two(&rhs, rhs_type); + + cut_assert_true(grn_operator_exec_less(context, &lhs, &rhs)); +} + +void +data_exec_less_false(void) +{ +#define ADD_DATA(lhs_type, rhs_type) \ + gcut_add_datum(lhs_type " < " rhs_type, \ + "lhs_type", G_TYPE_STRING, lhs_type, \ + "rhs_type", G_TYPE_STRING, rhs_type, \ + NULL) + + ADD_DATA("int32", "int32"); + ADD_DATA("text", "text"); + ADD_DATA("text", "int32"); + ADD_DATA("int32", "text"); + +#undef ADD_DATA +} + +void +test_exec_less_false(gconstpointer data) +{ + const gchar *lhs_type; + const gchar *rhs_type; + + lhs_type = gcut_data_get_string(data, "lhs_type"); + rhs_type = gcut_data_get_string(data, "rhs_type"); + + set_one(&lhs, lhs_type); + set_one(&rhs, rhs_type); + + cut_assert_false(grn_operator_exec_less(context, &lhs, &rhs)); +} -------------- next part -------------- HTML����������������������������...Download