当前位置: 首页>>代码示例>>C++>>正文


C++ cut_assert_equal_int函数代码示例

本文整理汇总了C++中cut_assert_equal_int函数的典型用法代码示例。如果您正苦于以下问题:C++ cut_assert_equal_int函数的具体用法?C++ cut_assert_equal_int怎么用?C++ cut_assert_equal_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cut_assert_equal_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_scale

void
test_scale (gconstpointer data)
{
    GtkWidget *scale;
    gint widget_value;
    gint xinput_value;
    const gchar *widget_name;
    const gchar *xinput_name;
    const gchar *box_name;

    widget_name = gcut_data_get_string(data, "widget-name");
    xinput_name = gcut_data_get_string(data, "xinput-name");
    box_name = gcut_data_get_string(data, "box-name");

    enable_widget(box_name);

    scale = get_widget(widget_name);
    cut_assert_true(GTK_IS_RANGE(scale));

    xinput_value = get_int_property_of_xinput(xinput_name);
    widget_value = gtk_test_slider_get_value(scale);
    cut_assert_equal_int(xinput_value, widget_value);

    gtk_test_slider_set_perc(scale, 50.0);
    wait_action();
    xinput_value = get_int_property_of_xinput(xinput_name);
    widget_value = gtk_test_slider_get_value(scale);
    cut_assert_equal_int(xinput_value, widget_value);
}
开发者ID:thisMagpie,项目名称:gpointing-device-settings,代码行数:29,代码来源:test-ui-widget.c

示例2: test_deck_createDeck

void test_deck_createDeck()
{
    struct Deck *deck;
    cut_assert_equal_pointer(NULL, deck_createDeck(MAX_GAME_PLAYERS + 1));
    cut_assert_equal_pointer(NULL, deck_createDeck(MIN_GAME_PLAYERS - 1));

    for (int i = MIN_GAME_PLAYERS; i <= MAX_GAME_PLAYERS; i++) {
        deck = deck_createDeck(i);
        int check = 0;
        if (deck == NULL)
            check++;
        cut_assert_equal_int(0, check);
        cut_assert_equal_int(i * MAX_CARDS, deck_getDeckSize(deck));
        
        int duplicates = 0;
        for (int j = 0; j < DECK_SIZE; j++)
            for (int k = 0; k < DECK_SIZE; k++)
                if (k != j && deck->cards[k] != NULL && deck->cards[j] != NULL
                    && deck->cards[k]->suit == deck->cards[j]->suit &&
                    deck->cards[k]->value == deck->cards[j]->value)
                    duplicates++;
        cut_assert_equal_int(0, duplicates);
        deck_deleteDeck(&deck);
    }
}
开发者ID:PhiOrg,项目名称:WhistGame-GTK,代码行数:25,代码来源:test-deck.c

示例3: test_round_copyScore

void test_round_copyScore()
{
    struct Round *round1 = round_createRound(1);
    struct Round *round2 = round_createRound(1);
    struct Player *players[MAX_GAME_PLAYERS];

    cut_assert_equal_int(ROUND_NULL, round_copyScore(NULL, round2));
    cut_assert_equal_int(ROUND_NULL, round_copyScore(round1, NULL));
    cut_assert_equal_int(ROUND_NULL, round_copyScore(NULL, NULL));

    for (int i = 0; i < MAX_GAME_PLAYERS; i++) {
        players[i] = player_createPlayer("A", i);
        round_addPlayer(round1, players[i]);
        round_addPlayer(round2, players[i]);
        round1->pointsNumber[i] = i;
    }

    cut_assert_equal_int(FUNCTIOON_NO_ERROR, round_copyScore(round1, round2));
    for (int i = 0; i < MAX_GAME_PLAYERS; i++)
        cut_assert_equal_int(round1->pointsNumber[i], round2->pointsNumber[i]);

    for (int i = 0; i < MAX_GAME_PLAYERS; i++)
        player_deletePlayer(&players[i]);

    round_deleteRound(&round1);
    round_deleteRound(&round2);
}
开发者ID:PhiOrg,项目名称:WhistGame-GTK,代码行数:27,代码来源:test-round.c

示例4: test_add_and_delete

void
test_add_and_delete(gconstpointer data)
{
  const grn_test_data *test_data = data;
  guint i;
  const guint n_operations = 7500;

  if (test_data->set_parameters)
    test_data->set_parameters();

  cut_assert_create_hash();

  ids = g_array_new(TRUE, TRUE, sizeof(grn_id));
  for (i = 0; i < n_operations; i++) {
    if (grn_test_hash_factory_get_flags(factory) & GRN_OBJ_KEY_VAR_SIZE)
      key_size = strlen(test_data->key);
    cut_assert_lookup_add(test_data->key);
    test_data->increment((grn_test_data *)test_data);
    g_array_append_val(ids, id);
  }

  cut_assert_equal_int(n_operations, GRN_HASH_SIZE(hash));
  for (i = 0; i < ids->len; i++) {
    grn_id delete_id;

    delete_id = g_array_index(ids, grn_id, i);
    cut_set_message("i = %d; id = %d", i, delete_id);
    grn_test_assert(grn_hash_delete_by_id(context, hash, delete_id, NULL));
  }
  cut_assert_equal_int(0, GRN_HASH_SIZE(hash));
}
开发者ID:hayamiz,项目名称:groonga,代码行数:31,代码来源:test-hash.c

示例5: test_hand_addCard

void test_hand_addCard()
{
    struct Hand *hand = hand_createHand();
    struct Deck *deck = deck_createDeck(MAX_GAME_PLAYERS);
    struct Player *players[MAX_GAME_PLAYERS + 1];   

    for (int i = 0; i < MAX_GAME_PLAYERS; i++) {
        players[i] = player_createPlayer("A", i);
        hand_addPlayer(hand, players[i]);
        struct Card *card  = deck->cards[i];
        struct Card *card2 = deck->cards[i];
        cut_assert_equal_int(FUNCTION_NO_ERROR, 
                            hand_addCard(hand, players[i], &(deck->cards[i])));
        cut_assert_equal_pointer(NULL, deck->cards[i]);
        int check = 0;
        for (int j = 0; j < MAX_GAME_PLAYERS; j++)
            if (players[i] == hand->players[j] && card == hand->cards[j])
                check++;
        cut_assert_equal_int(1, check);
    }
    players[MAX_GAME_PLAYERS] = player_createPlayer("A", 1);
    cut_assert_equal_int(NOT_FOUND,
                         hand_addCard(hand, players[MAX_GAME_PLAYERS],
                                      &deck->cards[MAX_GAME_PLAYERS]));

    for (int i = 0; i <= MAX_GAME_PLAYERS; i++)
        player_deletePlayer(&players[i]);
    deck_deleteDeck(&deck);
    hand_deleteHand(&hand);
}
开发者ID:PhiOrg,项目名称:WhistClient,代码行数:30,代码来源:test-hand.c

示例6: test_normalize_broken

void
test_normalize_broken(gconstpointer data)
{
  grn_obj *string;
  const gchar *input, *encoded_input;
  const gchar *normalized_text;
  grn_encoding input_encoding, context_encoding;
  gint input_length;
  guint normalized_text_length, normalized_text_n_characters;
  int flags = GRN_STRING_WITH_CHECKS | GRN_STRING_WITH_TYPES;

  context_encoding = gcut_data_get_int(data, "context-encoding");
  GRN_CTX_SET_ENCODING(&context, context_encoding);

  input = gcut_data_get_string(data, "input");
  input_encoding = gcut_data_get_int(data, "input-encoding");
  input_length = gcut_data_get_int(data, "input-length");
  encoded_input = convert_encoding(input, input_encoding);
  if (input_length < 0) {
    input_length = strlen(encoded_input);
  }
  string = grn_string_open(&context, encoded_input, input_length,
                           GRN_NORMALIZER_AUTO, flags);
  grn_string_get_normalized(&context, string,
                            &normalized_text,
                            &normalized_text_length,
                            &normalized_text_n_characters);
  normalized_text = cut_take_strndup(normalized_text, normalized_text_length);
  grn_obj_unlink(&context, string);

  cut_assert_equal_string("", normalized_text);
  cut_assert_equal_int(0, normalized_text_length);
  cut_assert_equal_int(0, normalized_text_n_characters);
}
开发者ID:WEIC-DEV,项目名称:groonga,代码行数:34,代码来源:test-string.c

示例7: test_toggle_button

void
test_toggle_button (gconstpointer data)
{
    GtkWidget *button, *dependent_widget;
    gboolean widget_value;
    gboolean xinput_value;
    const gchar *widget_name;
    const gchar *xinput_name;
    const gchar *dependent_widget_name;

    widget_name = gcut_data_get_string(data, "widget-name");
    xinput_name = gcut_data_get_string(data, "xinput-name");
    dependent_widget_name = gcut_data_get_string(data, "dependent-widget-name");

    button = get_widget(widget_name);
    cut_assert_true(GTK_IS_TOGGLE_BUTTON(button));

    xinput_value = get_boolean_property_of_xinput(xinput_name);
    widget_value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
    cut_assert_equal_int(xinput_value, widget_value);

    /* check widget sensitivity */
    dependent_widget = get_widget(dependent_widget_name);
    cut_assert_equal_int(widget_value, GTK_WIDGET_SENSITIVE(dependent_widget));

    gtk_test_widget_click(button, 1, 0);
    wait_action();
    xinput_value = get_boolean_property_of_xinput(xinput_name);
    cut_assert_equal_int(xinput_value, !widget_value);

    cut_assert_equal_int(!widget_value, GTK_WIDGET_SENSITIVE(dependent_widget));
}
开发者ID:thisMagpie,项目名称:gpointing-device-settings,代码行数:32,代码来源:test-ui-widget.c

示例8: test_round_repeatRound

void test_round_repeatRound()
{
    struct Round *round = round_createRound(1);
    struct Player *players[MAX_GAME_PLAYERS];

    for (int i = 0; i < MAX_GAME_PLAYERS; i++) {
        players[i] = player_createPlayer("A", i);
        round_addPlayer(round, players[i]);
    }

    for (int i = 0; i < MAX_GAME_PLAYERS; i++) {
        round->bids[i] = i;
        round->handsNumber[i] = i + 1;
    }

    cut_assert_equal_int(ROUND_NULL, round_repeatRound(NULL));
    cut_assert_equal_int(1, round_repeatRound(round));

    round->handsNumber[0] = 0;
    cut_assert_equal_int(FUNCTIOON_NO_ERROR, round_repeatRound(round));

    for (int i = 0; i < MAX_GAME_PLAYERS; i++)
        player_deletePlayer(&players[i]);

    round_deleteRound(&round);
}
开发者ID:PhiOrg,项目名称:WhistGame-GTK,代码行数:26,代码来源:test-round.c

示例9: test_memcached_replace

void
test_memcached_replace(void)
{
  uint32_t flags;
  memcached_return rc;

  rc = memcached_replace(memc, "key", 3, "value", 5, 0, 0xdeadbeefU);
  cut_set_message("memcached replace succeeded.");
  /* TODO: fix rc after libmemcached fix */
  cut_assert_equal_int(MEMCACHED_PROTOCOL_ERROR, rc);

  sleep(1);

  rc = memcached_add(memc, "key", 3, "value", 5, 0, 0xdeadbeefU);
  cut_set_message("memcached add failed.");
  cut_assert_equal_int(MEMCACHED_SUCCESS, rc);

  rc = memcached_replace(memc, "key", 3, "new-value", 9, 0, 0xdeadbeefU);
  cut_set_message("memcached replace failed.");
  cut_assert_equal_int(MEMCACHED_SUCCESS, rc);

  val1 = memcached_get(memc, "key", 3, &val1_len, &flags, &rc);
  cut_set_message("memcached get failed.");
  cut_assert_equal_int(MEMCACHED_SUCCESS, rc);
  cut_assert_equal_string("new-value", val1);
  cut_assert_equal_uint(0xdeadbeefU, flags);
}
开发者ID:ikdttr,项目名称:groonga,代码行数:27,代码来源:test-memcached.c

示例10: test_memcached_flush_with_time

void
test_memcached_flush_with_time(void)
{
  const int sleep_time = 1;
  uint32_t flags;
  memcached_return rc;

  rc = memcached_set(memc, "key", 3, "to be flushed", 13, 0, 0xdeadbeefU);
  cut_set_message("memcached set failed.");
  cut_assert_equal_int(MEMCACHED_SUCCESS, rc);

  memcached_flush(memc, sleep_time);

  val1 = memcached_get(memc, "key", 3, &val1_len, &flags, &rc);
  cut_set_message("memcached get failed.");
  cut_assert_equal_int(MEMCACHED_SUCCESS, rc);
  cut_assert_equal_string("to be flushed", val1);
  cut_assert_equal_uint(0xdeadbeefU, flags);

  sleep(sleep_time + 1);

  val2 = memcached_get(memc, "key", 3, &val2_len, &flags, &rc);
  cut_set_message("memcached get succeeded.");
  cut_assert_equal_int(MEMCACHED_NOTFOUND, rc);
}
开发者ID:ikdttr,项目名称:groonga,代码行数:25,代码来源:test-memcached.c

示例11: test_round_distributeDeck

void test_round_distributeDeck()
{
    struct Round *round = round_createRound(MAX_CARDS);
    struct Deck  *deck  = deck_createDeck(MAX_GAME_PLAYERS);
    struct Player *players[MAX_GAME_PLAYERS];

    cut_assert_equal_int(ROUND_NULL, round_distributeDeck(NULL, deck));
    cut_assert_equal_int(DECK_NULL, round_distributeDeck(round, NULL));

    for (int i = 0; i < MAX_GAME_PLAYERS; i++) {
        players[i] = player_createPlayer("A", i);
        round_addPlayer(round, players[i]);
    }

    cut_assert_equal_int(FUNCTIOON_NO_ERROR, round_distributeDeck(round, deck));
    cut_assert_equal_pointer(NULL, round->trump);
    for (int i = 0; i < MAX_GAME_PLAYERS; i++) {
        int nullCards = 0;
        int duplicate = 0;
        for (int j = 0; j < MAX_CARDS; j++)
            if (round->players[i]->hand[j] == NULL)
                nullCards++;
        for (int j = 0; j < MAX_CARDS - 1; j++)
            for (int k = j + 1; k < MAX_CARDS; k++)
                if (round->players[i]->hand[j] == round->players[i]->hand[k])
                    duplicate++;
        cut_assert_equal_int(0, nullCards);
        cut_assert_equal_int(0, duplicate);
    }

    round_deleteRound(&round);
    deck_deleteDeck(&deck);
    for (int i = 0; i < MAX_GAME_PLAYERS; i++)
        player_deletePlayer(&players[i]);
}
开发者ID:PhiOrg,项目名称:WhistGame-GTK,代码行数:35,代码来源:test-round.c

示例12: test_mb_res_pool_push_and_pop

void
test_mb_res_pool_push_and_pop(void)
{
    int i;
    struct iocb *iocb;

    cbpool = mb_res_pool_make(64);

    for(i = 0; i < 64; i++) {
        iocb = malloc(sizeof(struct iocb));
        cut_assert_equal_int(i, cbpool->nr_avail);
        cut_assert_equal_int(0, mb_res_pool_push(cbpool, iocb));
    }

    cut_assert_equal_int(64, cbpool->nr_avail);
    iocb = malloc(sizeof(struct iocb));

    // pushing into full pool fails
    cut_take_memory(iocb);
    cut_assert_equal_int(-1, mb_res_pool_push(cbpool, iocb));

    for(i = 0; i < 64; i++) {
        iocb = mb_res_pool_pop(cbpool);
        cut_assert_not_null(iocb);
        cut_assert_equal_int(64 - i - 1, cbpool->nr_avail,
                             cut_message("poped %d iocbs", i+1));
    }

    // now the pool is empty and pop fails
    iocb = mb_res_pool_pop(cbpool);
    cut_assert_null(iocb);
}
开发者ID:curvet,项目名称:micbench,代码行数:32,代码来源:test-micbench-io.c

示例13: test_round_determinesScore

void test_round_determinesScore()
{
    struct Round *round = round_createRound(1);
    struct Player *player;

    for (int i = 0; i < 3; i++) {
        player = player_createPlayer("A", i);
        round_addPlayer(round, player);
        player = NULL;
    }

    cut_assert_equal_int(ROUND_NULL, round_determinesScore(NULL));

    round->bids[0]        = 2;
    round->handsNumber[0] = 2;
    round->bids[1]        = 3;
    round->handsNumber[1] = 2;
    round->bids[2]        = 2;
    round->handsNumber[2] = 3;

    cut_assert_equal_int(FUNCTIOON_NO_ERROR, round_determinesScore(round));

    cut_assert_equal_int(7, round->pointsNumber[0]);
    cut_assert_equal_int(-1, round->pointsNumber[1]);
    cut_assert_equal_int(-1, round->pointsNumber[2]);

    for (int i = 0; i < 6; i++)
        player_deletePlayer(&round->players[i]);

    round_deleteRound(&round);
}
开发者ID:PhiOrg,项目名称:WhistGame-GTK,代码行数:31,代码来源:test-round.c

示例14: test_private

void
test_private (void)
{
    const gchar *packet;
    gsize packet_size;

    create_negotiate_packet(&packet, &packet_size);
    gcut_assert_equal_list_string(NULL, private_data_list);
    gcut_assert_error(feed(packet, packet_size));
    cut_assert_equal_int(1, n_negotiates);
    append_expected_private_data("option negotiation");
    gcut_assert_equal_list_string(expected_private_data_list,
                                  private_data_list);

    create_connect_packet_ipv4(&packet, &packet_size);
    gcut_assert_error(feed(packet, packet_size));
    cut_assert_equal_int(1, n_connects);
    append_expected_private_data("connect");
    gcut_assert_equal_list_string(expected_private_data_list,
                                  private_data_list);

    create_helo_packet(&packet, &packet_size);
    gcut_assert_error(feed(packet, packet_size));
    cut_assert_equal_int(1, n_helos);
    append_expected_private_data("helo");
    gcut_assert_equal_list_string(expected_private_data_list,
                                  private_data_list);
}
开发者ID:michaelm260,项目名称:milter-manager,代码行数:28,代码来源:test-client-context-data.c

示例15: test_wheel_axes

void
test_wheel_axes (gconstpointer data)
{
    GtkWidget *button;
    gint widget_value;
    const gchar *widget_name;
    WheelAxisAssertFunction assert_function;

    widget_name = gcut_data_get_string(data, "widget-name");
    assert_function = gcut_data_get_pointer(data, "assert-function");

    enable_widget("wheel_emulation_box");

    button = get_widget(widget_name);
    cut_assert_true(GTK_IS_CHECK_BUTTON(button));

    cut_assert_equal_int(4, get_scroll_axes_property_of_xinput());
    widget_value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
    assert_function(widget_value);

    gtk_test_widget_click(button, 1, 0);
    wait_action();
    cut_assert_equal_int(4, get_scroll_axes_property_of_xinput());
    widget_value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
    assert_function(widget_value);
}
开发者ID:thisMagpie,项目名称:gpointing-device-settings,代码行数:26,代码来源:test-ui-widget.c


注:本文中的cut_assert_equal_int函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。