Пример #1
0
void
test_str_len(gconstpointer data)
{
  size_t result, expected;
  const gchar *input;
  const char *input_end;
  grn_encoding encoding;

  input = gcut_data_get_string(data, "input");
  input_end = strchr(input, '\0');
  encoding = gcut_data_get_int(data, "encoding");
  result = grn_str_len(&context, input, encoding, &input_end);
  expected = gcut_data_get_size(data, "expected");
  cut_assert_equal_size(expected, result);
}
Пример #2
0
void
test_text_to_table(gconstpointer data)
{
  gsize expected_size;

  grn_obj_reinit(&context, &dest, users, 0);
  expected_size = gcut_data_get_size(data, "expected-size");
  if (expected_size == 0) {
    cast_text(GRN_INVALID_ARGUMENT, gcut_data_get_string(data, "text"));
    cut_assert_equal_uint(0, GRN_BULK_VSIZE(&dest));
  } else {
    cast_text(GRN_SUCCESS, gcut_data_get_string(data, "text"));
    grn_test_assert_equal_record_id(&context,
                                    grn_ctx_at(&context, users),
                                    gcut_data_get_uint(data, "expected"),
                                    GRN_RECORD_VALUE(&dest));
    cut_assert_equal_uint(expected_size, GRN_BULK_VSIZE(&dest));
  }
}