• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cut_message函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_memcached_replace

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

  grn_test_memcached_assert_equal_rc(
    MEMCACHED_NOTSTORED,
    memcached_replace(memc, "key", 3, "value", 5, 0, 0xdeadbeefU),
    cut_message("memcached replace succeeded."));

  sleep(1);

  grn_test_memcached_assert(
    memcached_add(memc, "key", 3, "value", 5, 0, 0xdeadbeefU),
    cut_message("memcached add failed."));

  grn_test_memcached_assert(
    memcached_replace(memc, "key", 3, "new-value", 9, 0, 0xdeadbeefU),
    cut_message("memcached replace failed."));

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


示例2: stub_failure_iterated_test

static void
stub_failure_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    MARK_FAIL(cut_assert_equal_int(2, GPOINTER_TO_INT(data)));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
开发者ID:hayamiz,项目名称:cutter,代码行数:7,代码来源:test-cut-test-iterator.c


示例3: test_read_write

void
test_read_write(gconstpointer *data)
{
  gint i, key;
  int added;
  grn_ctx *context;
  grn_hash *hash;
  const gchar *path;
  const gchar *value_string;
  gint process_number = 0;
  const gchar *process_number_string;
  void *value;
  grn_id id = GRN_ID_NIL;
  grn_rc rc;

  i = GPOINTER_TO_INT(data);
  process_number_string = g_getenv(GRN_TEST_ENV_PROCESS_NUMBER);
  if (process_number_string)
    process_number = atoi(process_number_string);

  key = i + process_number * N_THREADS;

  rc = grn_ctx_init(contexts[i], GRN_CTX_USE_QL);
  grn_test_assert(rc, cut_message("context: %d (%d)", i, process_number));
  context = contexts[i];

  path = g_getenv(GRN_TEST_ENV_HASH_PATH);
  cut_assert_not_null(path);
  hashes[i] = grn_hash_open(context, path);
  cut_assert_not_null(hashes[i],
                      cut_message("hash: %d (%d)", i, process_number));
  hash = hashes[i];

  grn_test_assert_nil(
    grn_hash_get(context, hash, &key, sizeof(key), &value),
    cut_message("lookup - fail: %d (%d:%d)", key, i, process_number));

  value_string = cut_take_printf("value: %d (%d:%d)", key, i, process_number);
  rc = grn_io_lock(context, hash->io, -1);
  if (rc != GRN_SUCCESS)
    grn_test_assert(rc);
  id = grn_hash_add(context, hash, &key, sizeof(key), &value, &added);
  grn_io_unlock(hash->io);
  grn_test_assert_not_nil(id);
  cut_assert_equal_int(1, added);
  strcpy(value, value_string);

  value = NULL;
  id = grn_hash_get(context, hash, &key, sizeof(key), &value);
  grn_test_assert_not_nil(
    id,
    cut_message("lookup - success: %d (%d:%d)", key, i, process_number));
  cut_assert_equal_string(value_string, value);

  hashes[i] = NULL;
  grn_test_assert(grn_hash_close(context, hash));

  contexts[i] = NULL;
  grn_test_assert(grn_ctx_fin(context));
}
开发者ID:WEIC-DEV,项目名称:groonga,代码行数:60,代码来源:test-stress-hash.c


示例4: test_memcached_flush_with_time

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

  grn_test_memcached_assert(
    memcached_set(memc, "key", 3, "to be flushed", 13, 0, 0xdeadbeefU),
    cut_message("memcached set failed."));

  memcached_flush(memc, sleep_time);

  val1 = memcached_get(memc, "key", 3, &val1_len, &flags, &rc);
  grn_test_memcached_assert(rc, cut_message("memcached get failed."));
  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);
  grn_test_memcached_assert_equal_rc(
    MEMCACHED_NOTFOUND, rc,
    cut_message("memcached get succeeded."));
}
开发者ID:darashi,项目名称:groonga,代码行数:25,代码来源:test-memcached.c


示例5: echo_service

void *
echo_service(void *arg)
{
  struct llc_connection *connection = (struct llc_connection *)arg;

  int old_cancelstate;
  pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate);

  cut_set_current_test_context(connection->link->cut_test_context);

  mqd_t llc_up = mq_open(connection->mq_up_name, O_RDONLY);
  cut_assert_false(llc_up == (mqd_t) - 1, cut_message("Can't open llc_up mqueue for reading"));

  mqd_t llc_down = mq_open(connection->mq_down_name, O_WRONLY);
  cut_assert_false(llc_down == (mqd_t) - 1, cut_message("Can't open llc_down mqueue for writing"));

  pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);

  for (;;) {
    char buffer[1024];
    int res = mq_receive(llc_up, buffer, sizeof(buffer), NULL);
    pthread_testcancel();
    cut_assert_equal_int(7, res, cut_message("Invalid message length"));
    cut_assert_equal_memory(buffer, res, "\x40\xc0Hello", 7, cut_message("Invalid message data"));
    sem_post(sem_cutter);
    pthread_testcancel();
  }
}
开发者ID:JiapengLi,项目名称:libllcp,代码行数:28,代码来源:test_dummy_mac_link.c


示例6: check_string_list_value

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); 
}
开发者ID:andrewdavis12,项目名称:cutter,代码行数:29,代码来源:keyfile.c


示例7: target_thread

void *
target_thread(void *arg)
{
    intptr_t res = 0;
    struct test_thread_data *thread_data = (struct test_thread_data *) arg;
    /*
    uint8_t id[] = {
    0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00
    };*/

    cut_set_current_test_context(thread_data->context);

    printf("Activating target...\n");
    struct llc_link *llc_link = llc_link_new();
    cut_assert_not_null(llc_link, cut_message("llc_link_new() failed"));

    struct mac_link *link = mac_link_new(thread_data->device, llc_link);
    cut_assert_not_null(link, cut_message("mac_link_new() failed"));

    res = mac_link_activate_as_target(link);
    cut_assert_equal_int(1, res, cut_message("mac_link_activate_as_target() failed"));

    sleep(3);

    printf("===== DEACTIVATE =====\n");
    mac_link_deactivate(link, MAC_DEACTIVATE_ON_REQUEST);
    mac_link_free(link);
    llc_link_free(llc_link);
    return (void *) res;
}
开发者ID:fatman2021,项目名称:libllcp,代码行数:30,代码来源:test_mac_link.c


示例8: test_mac_link

void
test_mac_link(void)
{
    int res;

    struct test_thread_data thread_data[2];

    thread_data[INITIATOR].context = thread_data[TARGET].context = cut_get_current_test_context();
    thread_data[INITIATOR].device = devices[INITIATOR];
    thread_data[TARGET].device = devices[TARGET];

    if ((res = pthread_create(&(threads[TARGET]), NULL, target_thread, &thread_data[TARGET])))
        cut_fail("pthread_create() returned %d", res);
    if ((res = pthread_create(&(threads[INITIATOR]), NULL, initiator_thread, &thread_data[INITIATOR])))
        cut_fail("pthread_create() returned %d", res);

    signal(SIGINT, abort_test_by_keypress);

    if ((res = pthread_join(threads[INITIATOR], (void *) &result[INITIATOR])))
        cut_fail("pthread_join() returned %d", res);
    if ((res = pthread_join(threads[TARGET], (void *) &result[TARGET])))
        cut_fail("pthread_join() returned %d", res);

    cut_assert_equal_int(0, result[INITIATOR], cut_message("Unexpected initiator return code"));
    cut_assert_equal_int(0, result[TARGET], cut_message("Unexpected target return code"));
}
开发者ID:fatman2021,项目名称:libllcp,代码行数:26,代码来源:test_mac_link.c


示例9: test_listing

/* 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);
}
开发者ID:andrewdavis12,项目名称:cutter,代码行数:61,代码来源:keyfile.c


示例10: test_read_write

void
test_read_write(gconstpointer *data)
{
  gint i;
  int added;
  grn_ctx *context;
  grn_obj *table;
  const gchar *path;
  const gchar *value_string;
  gint process_number = 0;
  const gchar *process_number_string;
  const gchar table_name[] = "performance-read-write";
  grn_obj value;
  grn_obj *retrieved_value;
  grn_id id;
  grn_rc rc;

  i = GPOINTER_TO_INT(data);
  process_number_string = g_getenv(GRN_TEST_ENV_PROCESS_NUMBER);
  if (process_number_string)
    process_number = atoi(process_number_string);

  rc = grn_ctx_init(&contexts[i], GRN_CTX_USE_QL);
  grn_test_assert(rc, cut_set_message("context: %d (%d)", i, process_number));
  context = &contexts[i];

  path = g_getenv(GRN_TEST_ENV_TABLE_PATH);
  cut_assert_not_null(path);
  tables[i] = grn_table_open(context, table_name, strlen(table_name),
                             path);
  cut_assert_not_null(tables[i],
                      cut_message("table: %d (%d)", i, process_number));
  table = tables[i];

  grn_test_assert_nil(grn_table_get(context, table, &i, sizeof(grn_id)),
                      cut_message("lookup - fail: (%d:%d)", i, process_number));

  value_string = cut_take_printf("value: (%d:%d)", i, process_number);
  id = grn_table_add(context, table, &i, sizeof(grn_id), &added);
  grn_test_assert_not_nil(id);
  cut_assert_equal_int(1, added);

  GRN_TEXT_INIT(&value, GRN_OBJ_DO_SHALLOW_COPY);
  GRN_TEXT_SET_REF(&value, value_string, strlen(value_string));
  grn_obj_set_value(context, table, id, &value, GRN_OBJ_SET);

  retrieved_value = grn_obj_get_value(context, table, id, NULL);
  grn_test_assert_not_nil(
    id,
    cut_message("lookup - success: (%d:%d)", i, process_number));
  GRN_TEXT_PUTC(context, retrieved_value, '\0');
  cut_assert_equal_string(value_string, GRN_BULK_HEAD(retrieved_value));

  tables[i] = NULL;
  grn_test_assert(grn_obj_close(context, table));

  //  contexts[i] = NULL;
  grn_test_assert(grn_ctx_fin(context));
}
开发者ID:WEIC-DEV,项目名称:groonga,代码行数:59,代码来源:test-read-write.c


示例11: stub_omission_iterated_test

static void
stub_omission_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    if (GPOINTER_TO_INT(data) == 2)
        MARK_FAIL(cut_omit("OMISSION!"));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
开发者ID:hayamiz,项目名称:cutter,代码行数:8,代码来源:test-cut-test-iterator.c


示例12: stub_notification_iterated_test

static void
stub_notification_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    if (GPOINTER_TO_INT(data) == 2)
        MARK_FAIL(cut_notify("NOTIFICATION!"));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
开发者ID:hayamiz,项目名称:cutter,代码行数:8,代码来源:test-cut-test-iterator.c


示例13: stub_pending_iterated_test

static void
stub_pending_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    if (GPOINTER_TO_INT(data) == 2)
        MARK_FAIL(cut_pend("PENDING!"));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
开发者ID:hayamiz,项目名称:cutter,代码行数:8,代码来源:test-cut-test-iterator.c


示例14: stub_error_iterated_test

static void
stub_error_iterated_test (gconstpointer data)
{
    cut_assert_true(TRUE, cut_message("always pass"));
    if (GPOINTER_TO_INT(data) == 2)
        MARK_FAIL(cut_error("ERROR!"));
    cut_assert_true(TRUE, cut_message("always pass if come here"));
}
开发者ID:hayamiz,项目名称:cutter,代码行数:8,代码来源:test-cut-test-iterator.c


示例15: test_tlv_rfu

void
test_tlv_rfu (void)
{
    uint8_t *data = malloc (0xffff);
    cut_assert_not_null (data, cut_message ("Out of memory"));

    uint8_t *res = tlv_encode (7, data, 0xffff, NULL);
    cut_assert_null (res, cut_message ("Size reserved for future use"));

    free (data);
}
开发者ID:charlesdhdt,项目名称:mfToolsCAS,代码行数:11,代码来源:test_tlv.c


示例16: test_add_cond_with_invalid_argument

void
test_add_cond_with_invalid_argument(void)
{
  unsigned int n_conds = 0, max_n_conds = 32U;
  const gchar keyword[] = "Groonga";
  unsigned int keyword_len;
  const gchar open_tag[] = "<<";
  const gchar close_tag[] = ">>";
  unsigned int open_tag_len, close_tag_len;

  keyword_len = strlen(keyword);
  open_tag_len = strlen(open_tag);
  close_tag_len = strlen(close_tag);

  cut_assert_open_snip();

  grn_test_assert(grn_snip_add_cond(&context, snip,
                                    keyword, keyword_len,
                                    open_tag, open_tag_len,
                                    close_tag, close_tag_len));
  n_conds++;

  grn_test_assert_equal_rc(GRN_INVALID_ARGUMENT,
                           grn_snip_add_cond(&context, NULL,
                                             keyword, keyword_len,
                                             open_tag, open_tag_len,
                                             close_tag, close_tag_len));
  grn_test_assert_equal_rc(GRN_INVALID_ARGUMENT,
                           grn_snip_add_cond(&context, snip,
                                             NULL, keyword_len,
                                             open_tag, open_tag_len,
                                             close_tag, close_tag_len));
  grn_test_assert_equal_rc(GRN_INVALID_ARGUMENT,
                           grn_snip_add_cond(&context, snip,
                                             keyword, 0,
                                             open_tag, open_tag_len,
                                             close_tag, close_tag_len));

  while (n_conds < max_n_conds) {
    grn_test_assert(grn_snip_add_cond(&context, snip,
                                      keyword, keyword_len,
                                      open_tag, open_tag_len,
                                      close_tag, close_tag_len),
                    cut_message("cond #%d", n_conds));
    n_conds++;
  }

  grn_test_assert_equal_rc(GRN_INVALID_ARGUMENT,
                           grn_snip_add_cond(&context, snip,
                                             keyword, keyword_len,
                                             open_tag, open_tag_len,
                                             close_tag, close_tag_len),
                           cut_message("cond #%d", n_conds));
}
开发者ID:AkioKanno,项目名称:groonga,代码行数:54,代码来源:test-snip.c


示例17: test_mifare_ultralight_get_uid

void
test_mifare_ultralight_get_uid (void)
{
    char *uid;

    uid = freefare_get_tag_uid (tag);

    cut_assert_not_null (uid, cut_message ("mifare_ultralight_get_uid() failed"));
    cut_assert_equal_int (14, strlen (uid), cut_message ("Wrong UID length"));

    free (uid);
}
开发者ID:jofell,项目名称:CocoaTag,代码行数:12,代码来源:test_mifare_ultralight.c


示例18: cut_setup

void
cut_setup (void)
{
    int res;
    nfc_connstring devices[8];
    size_t device_count;

    nfc_init (&context);
    cut_assert_not_null (context, cut_message ("Unable to init libnfc (malloc)"));

    device_count = nfc_list_devices (context, devices, 8);
    if (device_count <= 0)
        cut_omit ("No device found");

    for (size_t i = 0; i < device_count; i++) {

        device = nfc_open (context, devices[i]);
        if (!device)
            cut_omit ("nfc_open() failed.");

        tags = freefare_get_tags (device);
        cut_assert_not_null (tags, cut_message ("freefare_get_tags() failed"));

        tag = NULL;
        for (int i=0; tags[i]; i++) {
            if (freefare_get_tag_type(tags[i]) == MIFARE_DESFIRE) {
                tag = tags[i];
                res = mifare_desfire_connect (tag);
                cut_assert_equal_int (0, res, cut_message ("mifare_desfire_connect() failed"));

                struct mifare_desfire_version_info version_info;
                res = mifare_desfire_get_version (tag, &version_info);
                cut_assert_equal_int (0, res, cut_message ("mifare_desfire_get_version"));

                if (version_info.hardware.storage_size < 0x18) {
                    cut_omit ("DESFire EV1 tests require at least a 4K card");
                }

                if ((version_info.hardware.version_major >= 1) &&
                    (version_info.software.version_major >= 1)) {
                    return;
                }

                mifare_desfire_disconnect (tag);
            }
        }
        nfc_close (device);
        device = NULL;
        freefare_free_tags (tags);
        tags = NULL;
    }
    cut_omit ("No MIFARE DESFire EV1 tag on NFC device");
}
开发者ID:charlesdhdt,项目名称:mfToolsCAS,代码行数:53,代码来源:mifare_desfire_ev1_fixture.c


示例19: test_tlv_decode_short

void
test_tlv_decode_short (void)
{
    uint8_t *res;
    uint16_t size;
    uint8_t type;

    res = tlv_decode (eshortdata, &type, &size);
    cut_assert_equal_int (3, type, cut_message ("Wrong type"));
    cut_assert_equal_int (sizeof (shortdata), size, cut_message ("Wrong value length"));
    cut_assert_equal_memory (shortdata, sizeof (shortdata), res, size, cut_message ("Wrong decoded value"));
    free (res);
}
开发者ID:charlesdhdt,项目名称:mfToolsCAS,代码行数:13,代码来源:test_tlv.c


示例20: test_tlv_encode_short

void
test_tlv_encode_short (void)
{
    uint8_t *res;
    size_t osize;

    res = tlv_encode (3, shortdata, sizeof (shortdata), &osize);
    cut_assert_equal_int (sizeof (eshortdata), osize, cut_message ("Wrong encoded message length."));
    cut_assert_equal_int (3, res[0], cut_message ("Wrong type"));
    cut_assert_equal_int (sizeof (shortdata), res[1], cut_message ("Wrong value length"));
    cut_assert_equal_memory (eshortdata, sizeof (eshortdata), res, osize, cut_message ("Wrong encoded value"));
    free (res);
}
开发者ID:charlesdhdt,项目名称:mfToolsCAS,代码行数:13,代码来源:test_tlv.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cut_remove_path函数代码示例发布时间:2022-05-30
下一篇:
C++ cut_assert_true函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap