Exemplo n.º 1
0
/* check key and group listing */
void
test_listing (void)
{
  gchar **names;
  gsize len;
  gchar *start;
  GError *error = NULL;

  const gchar *data = 
    "[group1]\n"
    "key1=value1\n"
    "key2=value2\n"
    "[group2]\n"
    "key3=value3\n"
    "key4=value4\n";
  
  cut_assert (g_key_file_load_from_data (keyfile, data, -1, 0, NULL));

  names = g_key_file_get_groups (keyfile, &len);
  cut_assert (names);

  check_length ("groups", g_strv_length (names), len, 2);
  check_name ("group name", names[0], "group1", 0);
  check_name ("group name", names[1], "group2", 1);
  
  g_strfreev (names);
  
  names = g_key_file_get_keys (keyfile, "group1", &len, &error);
  check_no_error (error);

  check_length ("keys", g_strv_length (names), len, 2);
  check_name ("key", names[0], "key1", 0);
  check_name ("key", names[1], "key2", 1);

  g_strfreev (names);

  names = g_key_file_get_keys (keyfile, "no-such-group", &len, &error);
  check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND);

  g_strfreev (names);

  cut_assert (g_key_file_has_group (keyfile, "group1") &&
	      g_key_file_has_group (keyfile, "group2") &&
	      !g_key_file_has_group (keyfile, "group10") &&
	      !g_key_file_has_group (keyfile, "group2 "),
	      cut_message ("Group finding trouble"));

  start = g_key_file_get_start_group (keyfile);
  cut_assert_equal_string ("group1", start);
  g_free (start);

  cut_assert (g_key_file_has_key (keyfile, "group1", "key1", &error) &&
	      g_key_file_has_key (keyfile, "group2", "key3", &error) &&
	      !g_key_file_has_key (keyfile, "group2", "no-such-key", &error),
	      cut_message ("Key finding trouble"));
  check_no_error (error);
  
  g_key_file_has_key (keyfile, "no-such-group", "key", &error);
  check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND);
}
Exemplo n.º 2
0
static void
check_string_list_value (GKeyFile *keyfile, const gchar *group, const gchar *key, ...)
{ 
  gint i; 
  gchar *v, **value; 
  va_list args; 
  gsize len; 
  GError *error = NULL; 
  value = g_key_file_get_string_list (keyfile, group, key, &len, &error); 
  check_no_error (error); 
  cut_assert (value); 
  va_start (args, key); 
  i = 0; 
  v = va_arg (args, gchar*); 
  while (v) 
    { 
      cut_assert (value[i], 
                  cut_message ("Group %s key %s: list too short (%d)",
                               group, key, i));
      cut_assert_equal_string (value[i], v, 
                               cut_message ("Group %s key %s: mismatch at %d, "
                                            "expected %s, got %s",
                                            group, key, i, v, value[i]));
      i++; 
      v = va_arg (args, gchar*); 
    } 
  va_end (args); 
  g_strfreev (value); 
}
void
test_module_arguments (void)
{
    gchar *function_name = NULL;
    gint argc = 3;
    gchar *argv[] = {
        "test program",
        "-f", "stub-function",
        NULL,
    };
    gchar **copy_argv;
    copy_argv = g_strdupv(argv);

    factory = cut_module_factory_new("type1", "module1", NULL);
    cut_assert(factory);

    option_context = g_option_context_new(NULL);
    cut_module_factory_set_option_group(factory, option_context);
    cut_assert(g_option_context_parse(option_context, &argc, &copy_argv, NULL));
    g_strfreev(copy_argv);

    object = cut_module_factory_create(factory);
    cut_assert(object);

    g_object_get(object,
                 "name", &function_name,
                 NULL);
    cut_assert_equal_string_with_free("stub-function", function_name);

    g_object_unref(factory);
    factory = NULL;
}
Exemplo n.º 4
0
void
test_card_new(void)
{
   cut_set_message("スーツと番号からカードを作成");
  {
    Card sa = card_new(SPADE,ACE);
    cut_assert(card_suit(sa)==SPADE);
    cut_assert(card_no(sa)==ACE);
  }
}
Exemplo n.º 5
0
void
test_card_no_new_from_string(void)
{
  cut_set_message("番号から数値への変換のテスト");
  cut_assert(card_no_new_from_string("1")==ACE);
  cut_assert(card_no_new_from_string("13")==KING);
  cut_assert(card_no_new_from_string("12")==QUEEN);
  cut_assert(card_no_new_from_string("11")==JACK);
  cut_assert(card_no_new_from_string("10")==10);
}
Exemplo n.º 6
0
/* http://bugzilla.gnome.org/show_bug.cgi?id=165887 */
void 
test_group_remove (void)
{
  gchar **names;
  gsize len;
  GError *error = NULL;

  const gchar *data = 
    "[group1]\n"
    "[group2]\n"
    "key1=bla\n"
    "key2=bla\n"
    "[group3]\n"
    "key1=bla\n"
    "key2=bla\n";
  
  cut_assert (g_key_file_load_from_data (keyfile, data, -1, 0, NULL));
  
  names = g_key_file_get_groups (keyfile, &len);
  cut_assert (names);

  check_length ("groups", g_strv_length (names), len, 3);
  check_name ("group name", names[0], "group1", 0);
  check_name ("group name", names[1], "group2", 1);
  check_name ("group name", names[2], "group3", 2);

  g_key_file_remove_group (keyfile, "group1", &error);
  check_no_error (error);
  
  g_strfreev (names);

  names = g_key_file_get_groups (keyfile, &len);
  cut_assert (names);

  check_length ("groups", g_strv_length (names), len, 2);
  check_name ("group name", names[0], "group2", 0);
  check_name ("group name", names[1], "group3", 1);

  g_key_file_remove_group (keyfile, "group2", &error);
  check_no_error (error);
  
  g_strfreev (names);

  names = g_key_file_get_groups (keyfile, &len);
  cut_assert (names);

  check_length ("groups", g_strv_length (names), len, 1);
  check_name ("group name", names[0], "group3", 0);

  g_key_file_remove_group (keyfile, "no such group", &error);
  check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND);

  g_strfreev (names);
}
void
test_type_name (void)
{
    builder = g_object_new(CUT_TYPE_UI_FACTORY_BUILDER, NULL);
    cut_assert(builder);
    cut_assert_equal_string("ui",
                            cut_factory_builder_get_type_name(CUT_FACTORY_BUILDER(builder)));
    g_object_unref(builder);
    builder = NULL;

    builder = g_object_new(CUT_TYPE_REPORT_FACTORY_BUILDER, NULL);
    cut_assert(builder);
    cut_assert_equal_string("report",
                            cut_factory_builder_get_type_name(CUT_FACTORY_BUILDER(builder)));
}
Exemplo n.º 8
0
void
test_fixed_posting_list_copy (void)
{
    PostingList *original_list;
    FixedPostingList *ofplist;
    FixedPostingList *fplist;
    original_list = posting_list_new();
    posting_list_add(original_list, 0, 0);
    posting_list_add(original_list, 1, 2);
    ofplist = fixed_posting_list_new(original_list);

    fplist = fixed_posting_list_copy(ofplist);
    cut_assert(fplist != ofplist);
    cut_assert_not_null(fplist);
    cut_assert_equal_uint(2, fixed_posting_list_size(fplist));
    cut_assert_not_null(fixed_posting_list_check(fplist, 0, 0));
    cut_assert_not_null(fixed_posting_list_check(fplist, 1, 2));

    posting_list_add(original_list, 4, 5);
    fixed_posting_list_free(ofplist);
    ofplist = fixed_posting_list_new(original_list);
    cut_assert_equal_uint(3, fixed_posting_list_size(ofplist));
    cut_assert_equal_uint(2, fixed_posting_list_size(fplist));

    fixed_posting_list_free(ofplist);
    fixed_posting_list_free(fplist);
    posting_list_free(original_list, TRUE);
}
Exemplo n.º 9
0
/* check parsing of string values */
void
test_string (void)
{
  GError *error = NULL;
  gchar *value;

  const gchar *data = 
    "[valid]\n"
    "key1=\\s\\n\\t\\r\\\\\n"
    "key2=\"quoted\"\n"
    "key3='quoted'\n"
    "key4=\xe2\x89\xa0\xe2\x89\xa0\n"
    "[invalid]\n"
    "key1=\\a\\b\\0800xff\n"
    "key2=blabla\\\n";
  
  cut_assert (g_key_file_load_from_data (keyfile, data, -1, 0, NULL));

  check_string_value (keyfile, "valid", "key1", " \n\t\r\\");
  check_string_value (keyfile, "valid", "key2", "\"quoted\"");
  check_string_value (keyfile, "valid", "key3", "'quoted'");  
  check_string_value (keyfile, "valid", "key4", "\xe2\x89\xa0\xe2\x89\xa0");  
  
  value = g_key_file_get_string (keyfile, "invalid", "key1", &error);
  check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE);
  g_free (value);

  value = g_key_file_get_string (keyfile, "invalid", "key2", &error);
  check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE);
  g_free (value);
}
Exemplo n.º 10
0
void
test_load_cpp_data_driven_test (void)
{
    GList *test_cases, *test_case_node;
    gchar *expected_functions[] = {
        "data_driven_test::test_string",
        NULL
    };

    loader = loader_new("cpp", "stub-data-driven-test." G_MODULE_SUFFIX);
    test_cases = cut_loader_load_test_cases(loader);
    cut_assert_equal_int(1, g_list_length(test_cases));

    test_names = g_ptr_array_new_with_free_func(g_free);
    for (test_case_node = test_cases;
         test_case_node;
         test_case_node = g_list_next(test_case_node)) {
        CutTestContainer *container;
        GList *tests, *test_node;

        container = CUT_TEST_CONTAINER(test_case_node->data);
        tests = (GList *)cut_test_container_get_children(container);
        for (test_node = tests; test_node; test_node = g_list_next(test_node)) {
            CutTest *test = test_node->data;

            cut_assert(CUT_IS_TEST(test));
            g_ptr_array_add(test_names, g_strdup(cut_test_get_name(test)));
        }
    }
    g_ptr_array_sort(test_names, compare_test_name);
    g_ptr_array_add(test_names, NULL);
    cut_assert_equal_string_array(expected_functions,
                                  (gchar **)test_names->pdata);
}
Exemplo n.º 11
0
void
test_help (void)
{
    cut_assert(run_cutter("--help"));
    cut_assert_exit_success();
    cut_assert_equal_string(help_message, stdout_string);
}
Exemplo n.º 12
0
void
test_version (void)
{
    cut_assert(run_cutter("--version"));
    cut_assert_exit_success();
    cut_assert_equal_string(VERSION LINE_FEED_CODE, stdout_string);
}
Exemplo n.º 13
0
void
test_mb_aiom_submit_pwrite(void)
{
    mb_mock_init();

    char buf[512];
    int fd = 123;

    aiom = mb_aiom_make(64);

    mb_mock_assert_will_call("io_submit",
                             MOCK_ARG_PTR, aiom->context,
                             MOCK_ARG_INT, 1,
                             MOCK_ARG_SKIP, NULL,
                             NULL);
    struct iocb *head = aiom->cbpool->head->data;

    cut_assert_equal_int(0, aiom->nr_inflight);

    cut_assert_equal_int(1, mb_aiom_submit_pwrite(aiom, fd, buf, 512, 9999));

    cut_assert_equal_int(1, aiom->nr_inflight);

    cut_assert_equal_int(IO_CMD_PWRITE, head->aio_lio_opcode);
    cut_assert_equal_int(fd, head->aio_fildes);
    cut_assert_equal_pointer(buf, head->u.c.buf);
    cut_assert_equal_int(512, head->u.c.nbytes);
    cut_assert(9999 == head->u.c.offset);

    cut_assert_equal_int(63, mb_aiom_nr_submittable(aiom));

    mb_mock_finish();
}
Exemplo n.º 14
0
void
test_mb_aiom_prep_pwrite(void)
{
    char buf[512];
    int fd = 3;
    long long offset = 23456;
    struct iocb *_iocb;

    aiom = mb_aiom_make(64);

    cut_assert_equal_int(0, aiom->nr_pending);

    _iocb = mb_aiom_prep_pwrite(aiom, fd, buf, 512, offset);

    cut_assert_equal_int(1, aiom->nr_pending);

    cut_assert_not_null(_iocb);
    cut_assert_equal_int(63, mb_aiom_nr_submittable(aiom));

    cut_assert_equal_int(IO_CMD_PWRITE, _iocb->aio_lio_opcode);
    cut_assert_equal_int(fd, _iocb->aio_fildes);
    cut_assert_equal_pointer(buf, _iocb->u.c.buf);
    cut_assert_equal_int(512, _iocb->u.c.nbytes);
    cut_assert(offset == _iocb->u.c.offset);
}
Exemplo n.º 15
0
/* http://bugzilla.gnome.org/show_bug.cgi?id=165980 */
void 
test_key_remove (void)
{
  gchar *value;
  GError *error = NULL;

  const gchar *data = 
    "[group1]\n"
    "key1=bla\n"
    "key2=bla\n";
  
  cut_assert (g_key_file_load_from_data (keyfile, data, -1, 0, NULL));
  
  check_string_value (keyfile, "group1", "key1", "bla");

  g_key_file_remove_key (keyfile, "group1", "key1", &error);
  check_no_error (error);

  value = g_key_file_get_string (keyfile, "group1", "key1", &error);
  check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND);
  g_free (value);
  
  g_key_file_remove_key (keyfile, "group1", "key1", &error);
  check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND);

  g_key_file_remove_key (keyfile, "no such group", "key1", &error);
  check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND);
}
Exemplo n.º 16
0
void
test_no_option (void)
{
    cut_assert(run_cutter(NULL));
    cut_assert_exit_failure();
    cut_assert_equal_string(help_message, stdout_string);
}
Exemplo n.º 17
0
void
test_atomic (void)
{
  gint i;
  gint atomic = -5;
  gpointer atomic_pointer = NULL;
  gpointer biggest_pointer = (gpointer)((gsize)atomic_pointer - 1);

  for (i = 0; i < 15; i++)
    g_atomic_int_inc (&atomic);
  cut_assert_equal_int (10, atomic);
  for (i = 0; i < 9; i++)
    cut_assert (!g_atomic_int_dec_and_test (&atomic));
  cut_assert (g_atomic_int_dec_and_test (&atomic));
  cut_assert_equal_int (0, atomic);

  cut_assert_equal_int (0, g_atomic_int_exchange_and_add (&atomic, 5));
  cut_assert_equal_int (5, atomic);

  cut_assert_equal_int (5, g_atomic_int_exchange_and_add (&atomic, -10));
  cut_assert_equal_int (-5, atomic);

  g_atomic_int_add (&atomic, 20);
  cut_assert_equal_int (15, atomic);

  g_atomic_int_add (&atomic, -35);
  cut_assert_equal_int (-20, atomic);

  cut_assert_equal_int (atomic, g_atomic_int_get (&atomic));

  cut_assert (g_atomic_int_compare_and_exchange (&atomic, -20, 20));
  cut_assert_equal_int (20, atomic);
  
  cut_assert (!g_atomic_int_compare_and_exchange (&atomic, 42, 12));
  cut_assert_equal_int (20, atomic);
  
  cut_assert (g_atomic_int_compare_and_exchange (&atomic, 20, G_MAXINT));
  cut_assert_equal_int (G_MAXINT, atomic);

  cut_assert (g_atomic_int_compare_and_exchange (&atomic, G_MAXINT, G_MININT));
  cut_assert_equal_int (G_MININT, atomic);

  cut_assert (g_atomic_pointer_compare_and_exchange (&atomic_pointer, 
						     NULL, biggest_pointer));
  cut_assert_equal_pointer (biggest_pointer, atomic_pointer);

  cut_assert_equal_pointer (atomic_pointer, g_atomic_pointer_get (&atomic_pointer));

  cut_assert (g_atomic_pointer_compare_and_exchange (&atomic_pointer, 
						     biggest_pointer, NULL));
  cut_assert (biggest_pointer);
}
Exemplo n.º 18
0
void
test_invalid_verbose_option (void)
{
    cut_assert(run_cutter("--verbose=XXX"));
    cut_assert_exit_failure();
    cut_assert_equal_string("Invalid verbose level name: XXX" LINE_FEED_CODE,
                            stdout_string);
}
Exemplo n.º 19
0
void
test_invalid_option (void)
{
    cut_assert(run_cutter("--XXXX"));
    cut_assert_exit_failure();
    cut_assert_equal_string("Unknown option --XXXX" LINE_FEED_CODE,
                            stdout_string);
}
Exemplo n.º 20
0
void
test_invalid_order_option (void)
{
    cut_assert(run_cutter("--test-case-order=XXX"));
    cut_assert_exit_failure();
    cut_assert_equal_string("Invalid test case order value: XXX" LINE_FEED_CODE,
                            stdout_string);
}
Exemplo n.º 21
0
void
test_invalid_color_option (void)
{
    cut_assert(run_cutter("--color=XXX"));
    cut_assert_exit_failure();
    cut_assert_equal_string("Invalid color value: XXX" LINE_FEED_CODE,
                            stdout_string);
}
Exemplo n.º 22
0
void
test_load_function (void)
{
    CutTestContainer *container;
    GList *tests, *list;
    gint i;
    const gchar *target_test_names[] = {"/.*/", NULL};
    gchar *expected_functions[] = {
        "test_abcdefghijklmnopqratuvwzyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789",
        "test_stub_function1",
        "test_stub_function2",
        "test_stub_function3",
        NULL
    };

    loader = loader_new("test", "stub-test-functions." G_MODULE_SUFFIX);
    test_case = cut_loader_load_test_case(loader);
    cut_assert(test_case);

    container = CUT_TEST_CONTAINER(test_case);
    cut_assert_equal_int(4,
                         cut_test_container_get_n_tests(container, NULL));

    run_context = cut_test_runner_new();
    cut_run_context_set_target_test_names(run_context, target_test_names);
    cut_assert_equal_int(4,
                         cut_test_container_get_n_tests(container, run_context));

    tests = (GList *)cut_test_container_get_children(container);
    cut_assert(tests);

    test_names = g_ptr_array_new_with_free_func(g_free);
    for (list = tests, i = 0; list; list = g_list_next(list), i++) {
        CutTest *test;

        cut_assert(list->data);
        cut_assert(CUT_IS_TEST(list->data));

        test = CUT_TEST(list->data);
        g_ptr_array_add(test_names, g_strdup(cut_test_get_name(test)));
    }
    g_ptr_array_sort(test_names, compare_test_name);
    g_ptr_array_add(test_names, NULL);
    cut_assert_equal_string_array(expected_functions,
                                  (gchar **)test_names->pdata);
}
void
test_open_device (void)
{
    device = gpds_xinput_utils_open_device(DEVICE_NAME, &error);
    cut_assert(device);

    gcut_assert_error(error);
}
void
test_get_device_info (void)
{
    XDeviceInfo *device_info = NULL;
    device_info = gpds_xinput_utils_get_device_info(DEVICE_NAME, &error);
    cut_assert(device_info);

    gcut_assert_error(error);
}
Exemplo n.º 25
0
void
test_open(void)
{
    cut_assert_create();
    inverted_index_free();

    inverted_index = grn_ii_open(context, path, lexicon);
    cut_assert(inverted_index);
}
Exemplo n.º 26
0
void
test_module_names (void)
{
    factory = cut_module_factory_new("type1", "module1", NULL);
    cut_assert(factory);
    g_object_unref(factory);

    factory = cut_module_factory_new("type1", "module2", NULL);
    cut_assert(factory);
    g_object_unref(factory);

    factory = cut_module_factory_new("type1", "module3", NULL);
    cut_assert(factory);
    g_object_unref(factory);

    factory = cut_module_factory_new("type1", "module4", NULL);
    cut_assert_null(factory);
}
Exemplo n.º 27
0
void
test_fixture_function (gconstpointer data)
{
    const FixtureTestData *test_data = data;
    CutStartupFunction expected_startup_function = NULL;
    CutStartupFunction actual_startup_function = NULL;
    CutShutdownFunction expected_shutdown_function = NULL;
    CutShutdownFunction actual_shutdown_function = NULL;
    CutSetupFunction expected_setup_function = NULL;
    CutSetupFunction actual_setup_function = NULL;
    CutTeardownFunction expected_teardown_function = NULL;
    CutTeardownFunction actual_teardown_function = NULL;
    gchar *so_filename;

    loader = loader_new("fixture", test_data->file_name);
    test_case = cut_loader_load_test_case(loader);
    cut_assert(test_case);

    g_object_get(G_OBJECT(loader),
                 "so-filename", &so_filename,
                 NULL);
    module = g_module_open(so_filename,
                           G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
    g_free(so_filename);
    cut_assert_not_null(module);
    if (test_data->startup_function_name)
        cut_assert_true(g_module_symbol(module,
                                        test_data->startup_function_name,
                                        (gpointer)&expected_startup_function));
    if (test_data->setup_function_name)
        cut_assert_true(g_module_symbol(module,
                                        test_data->setup_function_name,
                                        (gpointer)&expected_setup_function));
    if (test_data->teardown_function_name)
        cut_assert_true(g_module_symbol(module,
                                        test_data->teardown_function_name,
                                        (gpointer)&expected_teardown_function));
    if (test_data->shutdown_function_name)
        cut_assert_true(g_module_symbol(module,
                                        test_data->shutdown_function_name,
                                        (gpointer)&expected_shutdown_function));

    g_object_get(G_OBJECT(test_case),
                 "startup-function", &actual_startup_function,
                 "setup-function", &actual_setup_function,
                 "teardown-function", &actual_teardown_function,
                 "shutdown-function", &actual_shutdown_function,
                 NULL);
    cut_assert_equal_pointer(expected_startup_function,
                             actual_startup_function);
    cut_assert_equal_pointer(expected_setup_function,
                             actual_setup_function);
    cut_assert_equal_pointer(expected_teardown_function,
                             actual_teardown_function);
    cut_assert_equal_pointer(expected_shutdown_function,
                             actual_shutdown_function);
}
Exemplo n.º 28
0
void
test_load_cpp_namespace (void)
{
    CutTestContainer *container;
    GList *tests, *list;
    gint i;
    const gchar *target_test_names[] = {"/.*/", NULL};
    gchar *expected_functions[] = {
        "calc::test_add",
        "calc::test_sub",
        NULL
    };

    loader = loader_new("cpp", "stub-namespace." G_MODULE_SUFFIX);
    test_case = cut_loader_load_test_case(loader);
    cut_assert(test_case);

    container = CUT_TEST_CONTAINER(test_case);
    cut_assert_equal_int(2,
                         cut_test_container_get_n_tests(container, NULL));

    run_context = cut_test_runner_new();
    cut_run_context_set_target_test_names(run_context, target_test_names);
    cut_assert_equal_int(2,
                         cut_test_container_get_n_tests(container, run_context));

    tests = (GList *)cut_test_container_get_children(container);
    cut_assert(tests);

    test_names = g_ptr_array_new_with_free_func(g_free);
    for (list = tests, i = 0; list; list = g_list_next(list), i++) {
        CutTest *test;

        cut_assert(list->data);
        cut_assert(CUT_IS_TEST(list->data));

        test = CUT_TEST(list->data);
        g_ptr_array_add(test_names, g_strdup(cut_test_get_name(test)));
    }
    g_ptr_array_sort(test_names, compare_test_name);
    g_ptr_array_add(test_names, NULL);
    cut_assert_equal_string_array(expected_functions,
                                  (gchar **)test_names->pdata);
}
Exemplo n.º 29
0
void
test_card_to_string(void)
{
  cut_set_message("カードを文字列にする");
  {
    Card sa = card_new(SPADE,ACE);

    cut_assert(strcmp(card_to_string(sa), "SA")==0);
  }
}
Exemplo n.º 30
0
static void
assert_create_context(const char *dbname, const char *server_name, int port,
                      history_gluon_result_t expected)
{
	history_gluon_result_t ret;
	ret = history_gluon_create_context(dbname, server_name, port, &g_ctx);
	cut_assert_equal_int(expected, ret);
	if (expected == HGL_SUCCESS)
		cut_assert(g_ctx);
}