예제 #1
0
static void
stub_error_in_data_setup_iterated_data (void)
{
    cut_add_data("First", GINT_TO_POINTER(1), NULL,
		 NULL);
    cut_add_data("Second", GINT_TO_POINTER(2), NULL,
		 NULL);
    cut_error("error in data setup");
    cut_add_data("Third", GINT_TO_POINTER(3), NULL,
                 NULL);
}
예제 #2
0
파일: test-hash.c 프로젝트: hayamiz/groonga
void
data_open(void)
{
  cut_add_data("default", NULL, NULL,
               "zero key size", set_key_size_to_zero, NULL,
               "zero value size", set_value_size_to_zero, NULL);
}
예제 #3
0
void
data_read_write(void)
{
  gint i;
  const gchar *n_processes, *process_number, *thread_type;

  n_processes = g_getenv(GRN_TEST_ENV_N_PROCESSES);
  if (!n_processes)
    n_processes = "?";

  process_number = g_getenv(GRN_TEST_ENV_PROCESS_NUMBER);
  if (!process_number)
    process_number = "?";

  if (g_getenv(GRN_TEST_ENV_MULTI_THREAD))
    thread_type = "multi thread";
  else
    thread_type = "single thread";

  for (i = 0; i < N_THREADS; i++) {
    cut_add_data(cut_take_printf("%s process(es)[%s] - %s[%d]",
                                 n_processes, process_number, thread_type, i),
                 GINT_TO_POINTER(i), NULL);
  }
}
void
data_format_reply (void)
{
    cut_add_data("no extended",
                 format_reply_test_data_new("450 rejected",
                                            450, NULL, "rejected"),
                 reply_test_data_free,
                 "extended",
                 format_reply_test_data_new("450 4.2.0 rejected by Greylist",
                                            450, "4.2.0",
                                            "rejected by Greylist"),
                 reply_test_data_free,
                 "multi line - no extend ",
                 format_reply_test_data_new("551 5.7.1 Forwarding to\r\n"
                                            "551 5.7.1 remote hosts\r\n"
                                            "551 5.7.1 disabled",
                                            551, "5.7.1",
                                            "Forwarding to\n"
                                            "remote hosts\r\n"
                                            "disabled"),
                 reply_test_data_free,
                 "multi line - extended",
                 format_reply_test_data_new("450 rejected\r\n"
                                            "450 by\r\n"
                                            "450 Greylist",
                                            450, NULL,
                                            "rejected\r\n"
                                            "by\r\n"
                                            "Greylist"),
                 reply_test_data_free);
}
예제 #5
0
void
data_cpp_fixture_function (void)
{
    cut_add_data("without prefix",
                 fixture_test_data_new("without-prefix." G_MODULE_SUFFIX,
                                       "startup",
                                       "setup",
                                       "teardown",
                                       "shutdown"),
                 fixture_test_data_free,
                 "with prefix",
                 fixture_test_data_new("with-prefix." G_MODULE_SUFFIX,
                                       "cut_startup",
                                       "cut_setup",
                                       "cut_teardown",
                                       "cut_shutdown"),
                 fixture_test_data_free,
                 "all",
                 fixture_test_data_new("all." G_MODULE_SUFFIX,
                                       "cut_startup",
                                       "cut_setup",
                                       "cut_teardown",
                                       "cut_shutdown"),
                 fixture_test_data_free,
                 NULL);
}
예제 #6
0
void
data_lcp_search(void)
{
  cut_add_data("default - nonexistence",
               lcp_test_data_new(NULL, "カッター", NULL, NULL),
               lcp_test_data_free,
               "default - short",
               lcp_test_data_new(NULL, "セ", NULL, NULL),
               lcp_test_data_free,
               "default - exact",
               lcp_test_data_new("セナ", "セナ", NULL, NULL),
               lcp_test_data_free,
               "default - long",
               lcp_test_data_new("セナセナ", "セナセナセナ", NULL, NULL),
               lcp_test_data_free,
               "sis - nonexistence",
               lcp_test_data_new(NULL, "カッター", set_sis, NULL),
               lcp_test_data_free,
               "sis - short",
               lcp_test_data_new("セ", "セ", set_sis, NULL),
               lcp_test_data_free,
               "sis - exact",
               lcp_test_data_new("セナ", "セナ", set_sis, NULL),
               lcp_test_data_free,
               "sis - long",
               lcp_test_data_new("セナセナ", "セナセナセナ",
                                 set_sis, NULL),
               lcp_test_data_free);
}
예제 #7
0
static void
stub_iterated_data (void)
{
    cut_add_data("First", GINT_TO_POINTER(1), NULL,
                 "Second", GINT_TO_POINTER(2), NULL,
                 "Third", GINT_TO_POINTER(3), NULL,
		 NULL);
}
예제 #8
0
void
data_get_enum (void)
{
    cut_add_data("exist",
                 get_enum_test_data_new(
                     "[group]\n"
                     "status=pending\n",
                     "group",
                     "status",
                     CUT_TYPE_TEST_RESULT_STATUS,
                     CUT_TEST_RESULT_PENDING,
                     NULL),
                 enum_test_data_free,
                 "nonexistent key",
                 get_enum_test_data_new(
                     "[group]\n"
                     "status=pending\n",
                     "group",
                     "unknown-key",
                     CUT_TYPE_TEST_RESULT_STATUS,
                     0,
                     g_error_new(G_KEY_FILE_ERROR,
                                 G_KEY_FILE_ERROR_KEY_NOT_FOUND,
                                 "Key file does not have key 'unknown-key'"
#if GLIB_CHECK_VERSION(2, 43, 0)
                                 " in group 'group'"
#endif
                                )),
                 enum_test_data_free,
                 "invalid enum value",
                 get_enum_test_data_new(
                     "[group]\n"
                     "status=unknown\n",
                     "group",
                     "status",
                     CUT_TYPE_TEST_RESULT_STATUS,
                     0,
                     g_error_new(GCUT_ENUM_ERROR,
                                 GCUT_ENUM_ERROR_INVALID_VALUE,
                                 "unknown enum value: "
                                 "<unknown>(CutTestResultStatus)")),
                 enum_test_data_free,
                 "invalid enum type",
                 get_enum_test_data_new(
                     "[group]\n"
                     "status=pending\n",
                     "group",
                     "status",
                     GCUT_TYPE_EGG,
                     0,
                     g_error_new(GCUT_ENUM_ERROR,
                                 GCUT_ENUM_ERROR_INVALID_TYPE,
                                 "invalid enum type: "
                                 "GCutEgg(%" G_GSIZE_FORMAT ")",
                                 GCUT_TYPE_EGG)),
                 enum_test_data_free);
}
예제 #9
0
void
data_extract_attachments (void)
{
    cut_add_data(extract_test_data[0].test_name,
                 &extract_test_data[0],
                 NULL,
                 extract_test_data[1].test_name,
                 &extract_test_data[1],
                 NULL,
                 NULL);
}
void
data_add_recipient_error_empty_recipient (void)
{
    cut_add_data("no recipient",
                 address_test_data_new("", NULL),
                 address_test_data_free,
                 "no recipient - parameters",
                 address_test_data_new("", "XXX"),
                 address_test_data_free,
                 NULL);
}
void
data_add_recipient (void)
{
    cut_add_data("recipient",
                 address_test_data_new("kou@localhost", NULL),
                 address_test_data_free,
                 "recipient - parameters",
                 address_test_data_new("kou@localhost", "XXX"),
                 address_test_data_free,
                 NULL);
}
void
data_change_from_error_empty_from (void)
{
    cut_add_data("parameters",
                 address_test_data_new("", "XXX"),
                 address_test_data_free,
                 "no parameters",
                 address_test_data_new("", NULL),
                 address_test_data_free,
                 NULL);
}
void
data_change_from (void)
{
    cut_add_data("from",
                 address_test_data_new("kou@localhost", NULL),
                 address_test_data_free,
                 "from - parameters",
                 address_test_data_new("kou@localhost", "XXX"),
                 address_test_data_free,
                 NULL);
}
예제 #14
0
void
data_translate(void)
{
    cut_add_data("simple data",
                 translate_test_data_new("first", 1),
                 translate_test_data_free,
                 "complex data",
                 translate_test_data_new("a hundred eleven", 111),
                 translate_test_data_free,
                 NULL);
}
예제 #15
0
static void
add_read_write_data(const gchar *type_name, grn_obj_flags flags)
{
  cut_add_data(cut_take_printf("%s - single process - single thread", type_name),
               test_data_new(type_name, flags, 1, FALSE), test_data_free,

               cut_take_printf("%s - single process - multi thread", type_name),
               test_data_new(type_name, flags, 1, TRUE), test_data_free,

               cut_take_printf("%s - multi process - single thread", type_name),
               test_data_new(type_name, flags, 10, FALSE), test_data_free,

               cut_take_printf("%s - multi process - multi thread", type_name),
               test_data_new(type_name, flags, 10, TRUE), test_data_free);
}
예제 #16
0
void
data_next_with_no_entry(void)
{
  cut_add_data("ascending",
               test_data_new(NULL, set_ascending, NULL),
               test_data_free,
               "ascending - sis",
               test_data_new(NULL, set_ascending, set_sis, NULL),
               test_data_free,
               "descending",
               test_data_new(NULL, set_descending, NULL),
               test_data_free,
               "descending - sis",
               test_data_new(NULL, set_descending, set_sis, NULL),
               test_data_free);
}
예제 #17
0
void
data_prefix_search(void)
{
  cut_add_data("default - nonexistence",
               xfix_test_data_new(GRN_END_OF_DATA, NULL, "カッター", NULL, NULL),
               xfix_test_data_free,
               "default - short",
               xfix_test_data_new(GRN_SUCCESS,
                                  gcut_list_string_new("セナ", "セナ + Ruby",
                                                       "セナセナ", NULL),
                                  "セ", NULL, NULL),
               xfix_test_data_free,
               "default - exact",
               xfix_test_data_new(GRN_SUCCESS,
                                  gcut_list_string_new("セナ", "セナ + Ruby",
                                                       "セナセナ", NULL),
                                  "セナ", NULL, NULL),
               xfix_test_data_free,
               "default - long",
               xfix_test_data_new(GRN_END_OF_DATA, NULL, "セナセナセナ",
                                  NULL, NULL),
               xfix_test_data_free,
               "sis - nonexistence",
               xfix_test_data_new(GRN_END_OF_DATA, NULL, "カッター",
                                  set_sis, NULL),
               xfix_test_data_free,
               "sis - short",
               xfix_test_data_new(GRN_SUCCESS,
                                  gcut_list_string_new("セ", "セナ",
                                                       "セナ + Ruby",
                                                       "セナセ", "セナセナ",
                                                       NULL),
                                  "セ", set_sis, NULL),
               xfix_test_data_free,
               "sis - exact",
               xfix_test_data_new(GRN_SUCCESS,
                                  gcut_list_string_new("セナ",
                                                       "セナ + Ruby",
                                                       "セナセ", "セナセナ",
                                                       NULL),
                                  "セナ", set_sis, NULL),
               xfix_test_data_free,
               "sis - long",
               xfix_test_data_new(GRN_END_OF_DATA, NULL, "セナセナセナ",
                                  set_sis, NULL),
               xfix_test_data_free);
}
예제 #18
0
void
data_value(void)
{
  cut_add_data("default",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "",
                                                  "セナ",
                                                  "",
                                                  "セナ + Ruby",
                                                  "",
                                                  /* should be set two values */
                                                  "セナセナ",
                                                  "上書きされた値 -",
                                                  "ナセナセ",
                                                  "VALUE2",
                                                  NULL),
                             set_ascending, set_value_size, NULL),
               test_data_free,

               "sis",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "",
                                                  "セ",
                                                  "",
                                                  "セナ",
                                                  "",
                                                  "セナ + Ruby",
                                                  "",
                                                  /* should be set two values */
                                                  "セナセ",
                                                  "",
                                                  "セナセナ",
                                                  "上書きされた値 -",
                                                  "ナ",
                                                  "",
                                                  "ナ + Ruby",
                                                  "",
                                                  "ナセ",
                                                  "",
                                                  "ナセナ",
                                                  "",
                                                  "ナセナセ",
                                                  "VALUE2",
                                                  NULL),
                             set_ascending, set_value_size, set_sis, NULL),
               test_data_free);
}
예제 #19
0
void
data_next_with_one_entry(void)
{
  cut_add_data("ascending",
               test_data_new(gcut_list_string_new("セナ", NULL),
                             set_ascending, NULL),
               test_data_free,
               "ascending - sis",
               test_data_new(gcut_list_string_new("セナ", "ナ", NULL),
                             set_ascending, set_sis, NULL),
               test_data_free,
               "descending",
               test_data_new(gcut_list_string_new("セナ", NULL),
                             set_descending, NULL),
               test_data_free,
               "descending - sis",
               test_data_new(gcut_list_string_new("ナ", "セナ", NULL),
                             set_descending, set_sis, NULL),
               test_data_free);
}
예제 #20
0
파일: test-hash.c 프로젝트: hayamiz/groonga
static void
add_variable_key_size_test_data(void)
{
  cut_add_data("uint32 - default",
               test_data_new(uint32_key_new(29), uint32_increment,
                             NULL),
               test_data_free,
               "uint32 - tiny",
               test_data_new(uint32_key_new(29), uint32_increment,
                             set_tiny_flags),
               test_data_free,
               "variable size - short - default",
               test_data_new(g_strdup("X"), string_increment,
                             set_variable_size),
               test_data_free,
               "variable size - short - tiny",
               test_data_new(g_strdup("X"), string_increment,
                             set_tiny_flags_and_variable_size),
               test_data_free,
               "variable size - long - default",
               test_data_new(g_strdup("must be long rather than sizeof(char *)"),
                             string_increment,
                             set_variable_size),
               test_data_free,
               "variable size - long - tiny",
               test_data_new(g_strdup("must be long rather than sizeof(char *)"),
                             string_increment,
                             set_tiny_flags_and_variable_size),
               test_data_free,
               "not uint32 size - default",
               test_data_new(g_strdup(not_uint32_size_key),
                             not_uint32_size_key_increment,
                             set_not_uint32_key_size),
               test_data_free,
               "not uint32 size - tiny",
               test_data_new(g_strdup(not_uint32_size_key),
                             not_uint32_size_key_increment,
                             set_tiny_flags_and_not_uint32_key_size),
               test_data_free);
}
예제 #21
0
void
data_delete(void)
{
  cut_add_data("default",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "セナ + Ruby",
                                                  "ナセナセ",
                                                  NULL),
                             set_ascending, NULL),
               test_data_free,
               "sis",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "セ",
                                                  "セナ + Ruby",
                                                  "セナセ",
                                                  "ナ + Ruby",
                                                  "ナセ",
                                                  "ナセナセ",
                                                  NULL),
                             set_ascending, set_sis, NULL),
               test_data_free);
}
예제 #22
0
void
data_get_flags (void)
{
    cut_add_data("exist",
                 get_flags_test_data_new(
                     "[group]\n"
                     "flags=first|third\n",
                     "group",
                     "flags",
                     CUTTEST_TYPE_FLAGS,
                     CUTTEST_FLAG_FIRST | CUTTEST_FLAG_THIRD,
                     NULL),
                 enum_test_data_free,
                 "nonexistent key",
                 get_flags_test_data_new(
                     "[group]\n"
                     "flags=second\n",
                     "group",
                     "unknown-key",
                     CUTTEST_TYPE_FLAGS,
                     0,
                     g_error_new(G_KEY_FILE_ERROR,
                                 G_KEY_FILE_ERROR_KEY_NOT_FOUND,
                                 "Key file does not have key 'unknown-key'"
#if GLIB_CHECK_VERSION(2, 43, 0)
                                 " in group 'group'"
#endif
                                )),
                 enum_test_data_free,
                 "invalid flags value",
                 get_flags_test_data_new(
                     "[group]\n"
                     "flags=First|unknown1|CUTTEST_FLAG_THIRD|unknown2\n",
                     "group",
                     "flags",
                     CUTTEST_TYPE_FLAGS,
                     CUTTEST_FLAG_FIRST | CUTTEST_FLAG_THIRD,
                     g_error_new(GCUT_ENUM_ERROR,
                                 GCUT_ENUM_ERROR_INVALID_VALUE,
                                 "unknown flags: "
                                 "<unknown1|unknown2>(CuttestFlags): "
                                 "<First|unknown1|CUTTEST_FLAG_THIRD|unknown2>: "
                                 "#<CuttestFlags: first|third "
                                 "(CUTTEST_FLAG_FIRST:0x1)|"
                                 "(CUTTEST_FLAG_THIRD:0x4)>")),
                 enum_test_data_free,
                 "invalid flags type",
                 get_flags_test_data_new(
                     "[group]\n"
                     "flags=second\n",
                     "group",
                     "flags",
                     GCUT_TYPE_EGG,
                     0,
                     g_error_new(GCUT_ENUM_ERROR,
                                 GCUT_ENUM_ERROR_INVALID_TYPE,
                                 "invalid flags type: "
                                 "GCutEgg(%" G_GSIZE_FORMAT ")",
                                 GCUT_TYPE_EGG)),
                 enum_test_data_free);
}
void
data_stop_on_end_of_message (void)
{
    cut_add_data("no data", NULL, NULL,
                 "with data", g_strdup("abcdefg"), NULL);
}
예제 #24
0
static void
add_data_descending_sis(void)
{
  cut_add_data("descending - sis",
               test_data_new(gcut_list_string_new("ナセナセ",
                                                  "ナセナ",
                                                  "ナセ",
                                                  "ナ + Ruby",
                                                  "ナ",
                                                  "セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  "セ",
                                                  "Groonga",
                                                  NULL),
                             set_descending, set_sis, NULL),
               test_data_free,
               "descending - max - sis",
               test_data_new(gcut_list_string_new("セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  "セ",
                                                  "Groonga",
                                                  NULL),
                             set_descending, set_max, set_sis, NULL),
               test_data_free,
               "descending - max - gt - sis",
               test_data_new(gcut_list_string_new("セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  "セ",
                                                  "Groonga",
                                                  NULL),
                             set_descending, set_max, set_gt, set_sis,
                             NULL),
               test_data_free,
               "descending - max - lt - sis",
               test_data_new(gcut_list_string_new("セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  "セ",
                                                  "Groonga",
                                                  NULL),
                             set_descending, set_max, set_lt, set_sis,
                             NULL),
               test_data_free,
               "descending - max - gt - lt - sis",
               test_data_new(gcut_list_string_new("セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  "セ",
                                                  "Groonga",
                                                  NULL),
                             set_descending, set_max, set_gt, set_lt,
                             set_sis, NULL),
               test_data_free,
               "descending - min - sis",
               test_data_new(gcut_list_string_new("ナセナセ",
                                                  "ナセナ",
                                                  "ナセ",
                                                  "ナ + Ruby",
                                                  "ナ",
                                                  "セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  NULL),
                             set_descending, set_min, set_sis, NULL),
               test_data_free,
               "descending - min - gt - sis",
               test_data_new(gcut_list_string_new("ナセナセ",
                                                  "ナセナ",
                                                  "ナセ",
                                                  "ナ + Ruby",
                                                  "ナ",
                                                  "セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  NULL),
                             set_descending, set_min, set_gt, set_sis,
                             NULL),
               test_data_free,
               "descending - min - lt - sis",
               test_data_new(gcut_list_string_new("ナセナセ",
                                                  "ナセナ",
                                                  "ナセ",
                                                  "ナ + Ruby",
                                                  "ナ",
                                                  "セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  NULL),
                             set_descending, set_min, set_lt, set_sis,
                             NULL),
               test_data_free,
               "descending - min - gt - lt - sis",
               test_data_new(gcut_list_string_new("ナセナセ",
                                                  "ナセナ",
                                                  "ナセ",
                                                  "ナ + Ruby",
                                                  "ナ",
                                                  "セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  NULL),
                             set_descending, set_min, set_gt, set_lt,
                             set_sis, NULL),
               test_data_free,
               "descending - max - min - sis",
               test_data_new(gcut_list_string_new("セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  NULL),
                             set_descending, set_max, set_min,
                             set_sis, NULL),
               test_data_free,
               "descending - max - min - gt - sis",
               test_data_new(gcut_list_string_new("セナセナ",
                                                  "セナセ",
                                                  "セナ + Ruby",
                                                  NULL),
                             set_descending, set_max, set_min, set_gt,
                             set_sis, NULL),
               test_data_free,
               "descending - max - min - lt - sis",
               test_data_new(gcut_list_string_new("セナセ",
                                                  "セナ + Ruby",
                                                  "セナ",
                                                  NULL),
                             set_descending, set_max, set_min, set_lt,
                             set_sis, NULL),
               test_data_free,
               "descending - max - min - gt - lt - sis",
               test_data_new(gcut_list_string_new("セナセ",
                                                  "セナ + Ruby",
                                                  NULL),
                             set_descending, set_max, set_min, set_gt,
                             set_lt, set_sis, NULL),
               test_data_free,
               "descending - high-min - sis",
               test_data_new(gcut_list_string_new("ナセナセ",
                                                  "ナセナ",
                                                  "ナセ",
                                                  "ナ + Ruby",
                                                  "ナ",
                                                  "セナセナ",
                                                  NULL),
                             set_descending, set_min_high, set_sis, NULL),
               test_data_free,
               "descending - low-max - sis",
               test_data_new(gcut_list_string_new("セナ",
                                                  "セ",
                                                  "Groonga",
                                                  NULL),
                             set_descending, set_max_low, set_sis, NULL),
               test_data_free,
               "descending - high-min - low-max - sis",
               test_data_new(NULL,
                             set_descending, set_min_high, set_max_low, set_sis,
                             NULL),
               test_data_free);
}
void
data_delete_recipient (void)
{
    cut_add_data("valid", g_strdup("kou@localhost"), g_free,
                 NULL);
}
예제 #26
0
static void
add_data_ascending(void)
{
  cut_add_data("ascending",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "セナ",
                                                  "セナ + Ruby",
                                                  "セナセナ",
                                                  "ナセナセ",
                                                  NULL),
                             set_ascending, NULL),
               test_data_free,
               "ascending - max",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "セナ",
                                                  "セナ + Ruby",
                                                  "セナセナ",
                                                  NULL),
                             set_ascending, set_max, NULL),
               test_data_free,
               "ascending - max - gt",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "セナ",
                                                  "セナ + Ruby",
                                                  "セナセナ",
                                                  NULL),
                             set_ascending, set_max, set_gt, NULL),
               test_data_free,
               "ascending - max - lt",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "セナ",
                                                  "セナ + Ruby",
                                                  NULL),
                             set_ascending, set_max, set_lt, NULL),
               test_data_free,
               "ascending - max - gt - lt",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "セナ",
                                                  "セナ + Ruby",
                                                  NULL),
                             set_ascending, set_max, set_gt, set_lt, NULL),
               test_data_free,
               "ascending - min",
               test_data_new(gcut_list_string_new("セナ",
                                                  "セナ + Ruby",
                                                  "セナセナ",
                                                  "ナセナセ",
                                                  NULL),
                             set_ascending, set_min, NULL),
               test_data_free,
               "ascending - min - gt",
               test_data_new(gcut_list_string_new("セナ + Ruby",
                                                  "セナセナ",
                                                  "ナセナセ",
                                                  NULL),
                             set_ascending, set_min, set_gt, NULL),
               test_data_free,
               "ascending - min - lt",
               test_data_new(gcut_list_string_new("セナ",
                                                  "セナ + Ruby",
                                                  "セナセナ",
                                                  "ナセナセ",
                                                  NULL),
                             set_ascending, set_min, set_lt, NULL),
               test_data_free,
               "ascending - min - gt - lt",
               test_data_new(gcut_list_string_new("セナ + Ruby",
                                                  "セナセナ",
                                                  "ナセナセ",
                                                  NULL),
                             set_ascending, set_min, set_gt, set_lt, NULL),
               test_data_free,
               "ascending - max - min",
               test_data_new(gcut_list_string_new("セナ",
                                                  "セナ + Ruby",
                                                  "セナセナ",
                                                  NULL),
                             set_ascending, set_max, set_min, NULL),
               test_data_free,
               "ascending - max - min - gt",
               test_data_new(gcut_list_string_new("セナ + Ruby",
                                                  "セナセナ",
                                                  NULL),
                             set_ascending, set_max, set_min, set_gt,
                             NULL),
               test_data_free,
               "ascending - max - min - lt",
               test_data_new(gcut_list_string_new("セナ",
                                                  "セナ + Ruby",
                                                  NULL),
                             set_ascending, set_max, set_min, set_lt,
                             NULL),
               test_data_free,
               "ascending - max - min - gt - lt",
               test_data_new(gcut_list_string_new("セナ + Ruby",
                                                  NULL),
                             set_ascending, set_max, set_min, set_gt,
                             set_lt, NULL),
               test_data_free,
               "ascending - high-min",
               test_data_new(gcut_list_string_new("セナセナ",
                                                  "ナセナセ",
                                                  NULL),
                             set_ascending, set_min_high, NULL),
               test_data_free,
               "ascending - low-max",
               test_data_new(gcut_list_string_new("Groonga",
                                                  "セナ",
                                                  NULL),
                             set_ascending, set_max_low, NULL),
               test_data_free,
               "ascending - high-min - low-max",
               test_data_new(NULL,
                             set_ascending, set_min_high, set_max_low, NULL),
               test_data_free);
}
void
data_set_reply (void)
{
    cut_add_data("success - no extended",
                 set_reply_test_data_new(NULL,
                                         450, NULL, "rejected"),
                 reply_test_data_free,
                 "success - extended",
                 set_reply_test_data_new(NULL,
                                         450, "4.2.0", "rejected by Greylist"),
                 reply_test_data_free);

    cut_add_data("success - multi line",
                 set_reply_test_data_new(NULL,
                                         551, "5.7.1",
                                         "Forwarding to\n"
                                         "remote hosts\r\n"
                                         "disabled"),
                 reply_test_data_free,
                 "success - multi line - extended",
                 set_reply_test_data_new(NULL,
                                         450, NULL,
                                         "rejected\r\n"
                                         "by\r\n"
                                         "Greylist"),
                 reply_test_data_free);

    cut_add_data("fail - invalid code range",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "return code should be 4XX or 5XX: <399>"),
                     399, NULL, "message"),
                 reply_test_data_free,
                 "fail - extended code is miss match",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "extended code should use the same class of "
                                 "status code: <450>:<5.7.1>"),
                     450, "5.7.1", "Forwarding to remote hosts disabled"),
                 reply_test_data_free);

    cut_add_data("fail - empty extended code",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "class of extended status code is missing: <>"),
                     551, "", "Forwarding to remote hosts disabled"),
                 reply_test_data_free,
                 "fail - class only extended code",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "subject of extended status code is missing: "
                                 "<5>"),
                     551, "5", "Forwarding to remote hosts disabled"),
                 reply_test_data_free,
                 "fail - class with dot only extended code",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "subject of extended status code is missing: "
                                 "<5.>"),
                     551, "5.", "Forwarding to remote hosts disabled"),
                 reply_test_data_free,
                 "fail - class and subject only extended code",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "detail of extended status code is missing: "
                                 "<5.7>"),
                     551, "5.7", "Forwarding to remote hosts disabled"),
                 reply_test_data_free,
                 "fail - class and subject with dot only extended code",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "detail of extended status code is missing: "
                                 "<5.7.>"),
                     551, "5.7.", "Forwarding to remote hosts disabled"),
                 reply_test_data_free);

    cut_add_data("fail - large class extended code",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "class of extended status code should be "
                                 "'2', '4' or '5': <55.7.1>"),
                     551, "55.7.1", "Forwarding to remote hosts disabled"),
                 reply_test_data_free,
                 "fail - large subject extended code",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "subject of extended status code should be "
                                 "less than 1000: <7489>: <5.7489.1>"),
                     551, "5.7489.1", "Forwarding to remote hosts disabled"),
                 reply_test_data_free,
                 "fail - large detail extended code",
                 set_reply_test_data_new(
                     g_error_new(MILTER_CLIENT_CONTEXT_ERROR,
                                 MILTER_CLIENT_CONTEXT_ERROR_INVALID_CODE,
                                 "detail of extended status code should be "
                                 "less than 1000: <1234>: <5.7.1234>"),
                     551, "5.7.1234", "Forwarding to remote hosts disabled"),
                 reply_test_data_free);
}
예제 #28
0
파일: test-hash.c 프로젝트: hayamiz/groonga
void
data_delete_by_id(void)
{
  cut_add_data("default", NULL, NULL,
               "tiny", set_tiny_flags, NULL);
}
예제 #29
0
파일: test-hash.c 프로젝트: hayamiz/groonga
void
data_get_key(void)
{
  cut_add_data("default", NULL, NULL,
               "tiny", set_tiny_flags, NULL);
}
예제 #30
0
파일: test-hash.c 프로젝트: hayamiz/groonga
void
data_set_value_with_null_value(void)
{
  cut_add_data("default", NULL, NULL,
               "tiny", set_tiny_flags, NULL);
}