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


C++ LOG_TEST函数代码示例

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


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

示例1: main

int main(int argc, char** argv) {
    
    LOG_TEST("HELLO");
    LOG_TEST("HELLO" << " !");
    
    return 0;
}
开发者ID:CCJY,项目名称:coliru,代码行数:7,代码来源:main.cpp

示例2: test_many_additions

static void test_many_additions(void) {
  grpc_chttp2_hptbl tbl;
  int i;
  char *key;
  char *value;

  LOG_TEST("test_many_additions");

  grpc_chttp2_hptbl_init(&tbl);

  for (i = 0; i < 1000000; i++) {
    grpc_mdelem *elem;
    gpr_asprintf(&key, "K:%d", i);
    gpr_asprintf(&value, "VALUE:%d", i);
    elem = grpc_mdelem_from_strings(key, value);
    GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem));
    GRPC_MDELEM_UNREF(elem);
    assert_index(&tbl, 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value);
    gpr_free(key);
    gpr_free(value);
    if (i) {
      gpr_asprintf(&key, "K:%d", i - 1);
      gpr_asprintf(&value, "VALUE:%d", i - 1);
      assert_index(&tbl, 2 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value);
      gpr_free(key);
      gpr_free(value);
    }
  }

  grpc_chttp2_hptbl_destroy(&tbl);
}
开发者ID:An-mol,项目名称:grpc,代码行数:31,代码来源:hpack_table_test.c

示例3: LOG_TEST

void mediadataclient_object_t::test<6>()
{
    //
    // Test navigate() with a bounce back
    //
    LOG_TEST(6);

    LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(
        _DATA_URLS(VALID_OBJECT_ID,
                   "1.0","true",
                   FAKE_OBJECT_MEDIA_CAP_URL,
                   FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR));
    {
        LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD);
        const char *TEST_URL = "http://example.com";
        mdc->navigate(o, 0, TEST_URL);
        ensure("post records", gPostRecords->size(), 0);
        ::pump_timers();

        // ensure bounce back
        ensure("bounce back",
               dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o))->getNumBounceBacks(),
               1);

        ensure("post records", gPostRecords->size(), 1);
        ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR);
        ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
        ensure("post data", (*gPostRecords)[0]["body"][LLTextureEntry::TEXTURE_INDEX_KEY], 0);
        ensure("post data", (*gPostRecords)[0]["body"][LLMediaEntry::CURRENT_URL_KEY], TEST_URL);
        ensure("queue empty", mdc->isEmpty());
    }
    ensure("REF COUNT", o->getNumRefs(), 1);
}
开发者ID:Belxjander,项目名称:Kirito,代码行数:33,代码来源:llmediadataclient_test.cpp

示例4: test_encoding

void test_encoding(void) {
    LOG_TEST();
    assert_encodes_as(gpr_time_from_micros(-1), "1n");
    assert_encodes_as(gpr_time_from_seconds(-10), "1n");
    assert_encodes_as(gpr_time_from_nanos(10), "10n");
    assert_encodes_as(gpr_time_from_nanos(999999999), "1S");
    assert_encodes_as(gpr_time_from_micros(1), "1u");
    assert_encodes_as(gpr_time_from_micros(10), "10u");
    assert_encodes_as(gpr_time_from_micros(100), "100u");
    assert_encodes_as(gpr_time_from_micros(890), "890u");
    assert_encodes_as(gpr_time_from_micros(900), "900u");
    assert_encodes_as(gpr_time_from_micros(901), "901u");
    assert_encodes_as(gpr_time_from_millis(1), "1m");
    assert_encodes_as(gpr_time_from_millis(2), "2m");
    assert_encodes_as(gpr_time_from_micros(10001), "10100u");
    assert_encodes_as(gpr_time_from_micros(999999), "1S");
    assert_encodes_as(gpr_time_from_millis(1000), "1S");
    assert_encodes_as(gpr_time_from_millis(2000), "2S");
    assert_encodes_as(gpr_time_from_millis(2500), "2500m");
    assert_encodes_as(gpr_time_from_millis(59900), "59900m");
    assert_encodes_as(gpr_time_from_seconds(50), "50S");
    assert_encodes_as(gpr_time_from_seconds(59), "59S");
    assert_encodes_as(gpr_time_from_seconds(60), "1M");
    assert_encodes_as(gpr_time_from_seconds(80), "80S");
    assert_encodes_as(gpr_time_from_seconds(90), "90S");
    assert_encodes_as(gpr_time_from_minutes(2), "2M");
    assert_encodes_as(gpr_time_from_minutes(20), "20M");
    assert_encodes_as(gpr_time_from_hours(1), "1H");
    assert_encodes_as(gpr_time_from_hours(10), "10H");
    assert_encodes_as(gpr_time_from_seconds(1000000000), "1000000000S");
}
开发者ID:jwatt,项目名称:kythe,代码行数:31,代码来源:timeout_encoding_test.c

示例5: test_encoding

void test_encoding(void) {
  LOG_TEST("test_encoding");
  assert_encodes_as(gpr_time_from_micros(-1, GPR_TIMESPAN), "1n");
  assert_encodes_as(gpr_time_from_seconds(-10, GPR_TIMESPAN), "1n");
  assert_encodes_as(gpr_time_from_nanos(10, GPR_TIMESPAN), "10n");
  assert_encodes_as(gpr_time_from_nanos(999999999, GPR_TIMESPAN), "1S");
  assert_encodes_as(gpr_time_from_micros(1, GPR_TIMESPAN), "1u");
  assert_encodes_as(gpr_time_from_micros(10, GPR_TIMESPAN), "10u");
  assert_encodes_as(gpr_time_from_micros(100, GPR_TIMESPAN), "100u");
  assert_encodes_as(gpr_time_from_micros(890, GPR_TIMESPAN), "890u");
  assert_encodes_as(gpr_time_from_micros(900, GPR_TIMESPAN), "900u");
  assert_encodes_as(gpr_time_from_micros(901, GPR_TIMESPAN), "901u");
  assert_encodes_as(gpr_time_from_millis(1, GPR_TIMESPAN), "1m");
  assert_encodes_as(gpr_time_from_millis(2, GPR_TIMESPAN), "2m");
  assert_encodes_as(gpr_time_from_micros(10001, GPR_TIMESPAN), "10100u");
  assert_encodes_as(gpr_time_from_micros(999999, GPR_TIMESPAN), "1S");
  assert_encodes_as(gpr_time_from_millis(1000, GPR_TIMESPAN), "1S");
  assert_encodes_as(gpr_time_from_millis(2000, GPR_TIMESPAN), "2S");
  assert_encodes_as(gpr_time_from_millis(2500, GPR_TIMESPAN), "2500m");
  assert_encodes_as(gpr_time_from_millis(59900, GPR_TIMESPAN), "59900m");
  assert_encodes_as(gpr_time_from_seconds(50, GPR_TIMESPAN), "50S");
  assert_encodes_as(gpr_time_from_seconds(59, GPR_TIMESPAN), "59S");
  assert_encodes_as(gpr_time_from_seconds(60, GPR_TIMESPAN), "1M");
  assert_encodes_as(gpr_time_from_seconds(80, GPR_TIMESPAN), "80S");
  assert_encodes_as(gpr_time_from_seconds(90, GPR_TIMESPAN), "90S");
  assert_encodes_as(gpr_time_from_minutes(2, GPR_TIMESPAN), "2M");
  assert_encodes_as(gpr_time_from_minutes(20, GPR_TIMESPAN), "20M");
  assert_encodes_as(gpr_time_from_hours(1, GPR_TIMESPAN), "1H");
  assert_encodes_as(gpr_time_from_hours(10, GPR_TIMESPAN), "10H");
  assert_encodes_as(gpr_time_from_seconds(1000000000, GPR_TIMESPAN),
                    "1000000000S");
}
开发者ID:201528013359030,项目名称:grpc,代码行数:32,代码来源:timeout_encoding_test.c

示例6: test_many_additions

static void test_many_additions(void) {
  grpc_chttp2_hptbl tbl;
  int i;
  char *key;
  char *value;
  grpc_mdctx *mdctx;

  LOG_TEST("test_many_additions");

  mdctx = grpc_mdctx_create();
  grpc_chttp2_hptbl_init(&tbl, mdctx);

  for (i = 0; i < 1000000; i++) {
    gpr_asprintf(&key, "K:%d", i);
    gpr_asprintf(&value, "VALUE:%d", i);
    grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, key, value));
    assert_index(&tbl, 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value);
    gpr_free(key);
    gpr_free(value);
    if (i) {
      gpr_asprintf(&key, "K:%d", i - 1);
      gpr_asprintf(&value, "VALUE:%d", i - 1);
      assert_index(&tbl, 2 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value);
      gpr_free(key);
      gpr_free(value);
    }
  }

  grpc_chttp2_hptbl_destroy(&tbl);
  grpc_mdctx_unref(mdctx);
}
开发者ID:Zerqkboo,项目名称:grpc,代码行数:31,代码来源:hpack_table_test.c

示例7: test_cq_end_read

static void test_cq_end_read(void) {
  grpc_event *ev;
  grpc_completion_queue *cc;
  int on_finish_called = 0;
  void *tag = create_test_tag();

  LOG_TEST();

  cc = grpc_completion_queue_create();

  grpc_cq_begin_op(cc, NULL, GRPC_READ);
  grpc_cq_end_read(cc, tag, NULL, increment_int_on_finish, &on_finish_called,
                   NULL);

  ev = grpc_completion_queue_next(cc, gpr_inf_past);
  GPR_ASSERT(ev != NULL);
  GPR_ASSERT(ev->type == GRPC_READ);
  GPR_ASSERT(ev->tag == tag);
  GPR_ASSERT(ev->data.read == NULL);
  GPR_ASSERT(on_finish_called == 0);
  grpc_event_finish(ev);
  GPR_ASSERT(on_finish_called == 1);

  shutdown_and_destroy(cc);
}
开发者ID:Abioy,项目名称:kythe,代码行数:25,代码来源:completion_queue_test.c

示例8: set_test_name

void object::test<2>() {
    set_test_name("Run");
    putchar('\n');

    elf::time64_t st = elf::time_ms();

    for (int i = 0; i < TIMER_NUMBER; ++i) {
        elf::timer_add(rand() % TIMER_MAX_LIFE, "timer.onTimeout");
    }

    while (elf::timer_size()) {
        elf::time64_t time = elf::time_ms();

        elf::timer_run();

        // Clamp the framerate so that we do not hog all the CPU.
        const int MIN_FRAME_TIME = 1000 / FPS;
        elf::time64_t last_frame = time;
        int dt = (int)elf::time_diff(last_frame, time);

        last_frame = time;
        if (dt < MIN_FRAME_TIME) {
            int ms = MIN_FRAME_TIME - dt;
            if (ms >= 0)
                usleep(ms);
        }
    }

    elf::time64_t delta = elf::time_diff(elf::time_ms(), st);

    LOG_TEST("Run %d timers: %lld.%03lld s",
            TIMER_NUMBER,
            delta / 1000, delta % 1000);
    elf::timer_stat();
}
开发者ID:youngtrips,项目名称:elfox,代码行数:35,代码来源:test_timer.cpp

示例9: test_readall

static void test_readall(void) {
  char* lotsa_as[512];
  char* lotsa_bs[1024];
  gpr_slice slices[2];
  grpc_byte_buffer *buffer;
  grpc_byte_buffer_reader reader;
  gpr_slice slice_out;

  LOG_TEST("test_readall");

  memset(lotsa_as, 'a', 512);
  memset(lotsa_bs, 'b', 1024);
  /* use slices large enough to overflow inlining */
  slices[0] = gpr_slice_malloc(512);
  memcpy(GPR_SLICE_START_PTR(slices[0]), lotsa_as, 512);
  slices[1] = gpr_slice_malloc(1024);
  memcpy(GPR_SLICE_START_PTR(slices[1]), lotsa_bs, 1024);

  buffer = grpc_raw_byte_buffer_create(slices, 2);
  gpr_slice_unref(slices[0]);
  gpr_slice_unref(slices[1]);

  grpc_byte_buffer_reader_init(&reader, buffer);
  slice_out = grpc_byte_buffer_reader_readall(&reader);

  GPR_ASSERT(GPR_SLICE_LENGTH(slice_out) == 512 + 1024);
  GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(slice_out), lotsa_as, 512) == 0);
  GPR_ASSERT(memcmp(&(GPR_SLICE_START_PTR(slice_out)[512]), lotsa_bs, 1024) ==
             0);
  gpr_slice_unref(slice_out);
  grpc_byte_buffer_destroy(buffer);
}
开发者ID:hungle,项目名称:grpc,代码行数:32,代码来源:byte_buffer_reader_test.c

示例10: test_create_many_persistant_metadata

static void test_create_many_persistant_metadata(void) {
  grpc_mdctx *ctx;
  char buffer[GPR_LTOA_MIN_BUFSIZE];
  long i;
  grpc_mdelem **created = gpr_malloc(sizeof(grpc_mdelem *) * MANY);
  grpc_mdelem *md;

  LOG_TEST("test_create_many_persistant_metadata");

  ctx = grpc_mdctx_create();
  /* add phase */
  for (i = 0; i < MANY; i++) {
    gpr_ltoa(i, buffer);
    created[i] = grpc_mdelem_from_strings(ctx, "a", buffer);
  }
  /* verify phase */
  for (i = 0; i < MANY; i++) {
    gpr_ltoa(i, buffer);
    md = grpc_mdelem_from_strings(ctx, "a", buffer);
    GPR_ASSERT(md == created[i]);
    GRPC_MDELEM_UNREF(md);
  }
  /* cleanup phase */
  for (i = 0; i < MANY; i++) {
    GRPC_MDELEM_UNREF(created[i]);
  }
  grpc_mdctx_unref(ctx);

  gpr_free(created);
}
开发者ID:nkibler,项目名称:grpc,代码行数:30,代码来源:metadata_test.c

示例11: test_no_op_with_start

static void test_no_op_with_start(void) {
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_tcp_server *s = grpc_tcp_server_create(NULL);
    LOG_TEST("test_no_op_with_start");
    grpc_tcp_server_start(&exec_ctx, s, NULL, 0, on_connect, NULL);
    grpc_tcp_server_unref(&exec_ctx, s);
    grpc_exec_ctx_finish(&exec_ctx);
}
开发者ID:kriswuollett,项目名称:grpc,代码行数:8,代码来源:tcp_server_posix_test.c

示例12: test_no_op

static void test_no_op(void) {
  grpc_mdctx *ctx;

  LOG_TEST("test_no_op");

  ctx = grpc_mdctx_create();
  grpc_mdctx_unref(ctx);
}
开发者ID:nkibler,项目名称:grpc,代码行数:8,代码来源:metadata_test.c

示例13: test_no_op

/* test creation & destruction */
static void test_no_op(void) {
  grpc_chttp2_stream_map map;

  LOG_TEST("test_no_op");

  grpc_chttp2_stream_map_init(&map, 8);
  grpc_chttp2_stream_map_destroy(&map);
}
开发者ID:An-mol,项目名称:grpc,代码行数:9,代码来源:stream_map_test.c

示例14: test_no_op_with_start

static void test_no_op_with_start(void) {
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
  grpc_udp_server *s = grpc_udp_server_create();
  LOG_TEST("test_no_op_with_start");
  grpc_udp_server_start(&exec_ctx, s, NULL, 0, NULL);
  grpc_udp_server_destroy(&exec_ctx, s, NULL);
  grpc_exec_ctx_finish(&exec_ctx);
}
开发者ID:y-zeng,项目名称:grpc,代码行数:8,代码来源:udp_server_test.c

示例15: test_merge

static void test_merge(void) {
  gpr_histogram *h1, *h2;
  double last;
  double i;
  double cur;

  LOG_TEST("test_merge");

  h1 = gpr_histogram_create(0.05, 1e9);
  gpr_histogram_add(h1, 2.5);
  gpr_histogram_add(h1, 2.5);
  gpr_histogram_add(h1, 8);
  gpr_histogram_add(h1, 4);

  h2 = gpr_histogram_create(0.01, 1e9);
  GPR_ASSERT(gpr_histogram_merge(h1, h2) == 0);
  gpr_histogram_destroy(h2);

  h2 = gpr_histogram_create(0.05, 1e10);
  GPR_ASSERT(gpr_histogram_merge(h1, h2) == 0);
  gpr_histogram_destroy(h2);

  h2 = gpr_histogram_create(0.05, 1e9);
  GPR_ASSERT(gpr_histogram_merge(h1, h2) == 1);
  GPR_ASSERT(gpr_histogram_count(h1) == 4);
  GPR_ASSERT(gpr_histogram_minimum(h1) == 2.5);
  GPR_ASSERT(gpr_histogram_maximum(h1) == 8);
  GPR_ASSERT(gpr_histogram_sum(h1) == 17);
  GPR_ASSERT(gpr_histogram_sum_of_squares(h1) == 92.5);
  GPR_ASSERT(gpr_histogram_mean(h1) == 4.25);
  GPR_ASSERT(gpr_histogram_variance(h1) == 5.0625);
  GPR_ASSERT(gpr_histogram_stddev(h1) == 2.25);
  gpr_histogram_destroy(h2);

  h2 = gpr_histogram_create(0.05, 1e9);
  gpr_histogram_add(h2, 7.0);
  gpr_histogram_add(h2, 17.0);
  gpr_histogram_add(h2, 1.0);
  GPR_ASSERT(gpr_histogram_merge(h1, h2) == 1);
  GPR_ASSERT(gpr_histogram_count(h1) == 7);
  GPR_ASSERT(gpr_histogram_minimum(h1) == 1.0);
  GPR_ASSERT(gpr_histogram_maximum(h1) == 17.0);
  GPR_ASSERT(gpr_histogram_sum(h1) == 42.0);
  GPR_ASSERT(gpr_histogram_sum_of_squares(h1) == 431.5);
  GPR_ASSERT(gpr_histogram_mean(h1) == 6.0);

  /* test monotonicity */
  last = 0.0;
  for (i = 0; i < 100.0; i += 0.01) {
    cur = gpr_histogram_percentile(h1, i);
    GPR_ASSERT(cur >= last);
    last = cur;
  }

  gpr_histogram_destroy(h1);
  gpr_histogram_destroy(h2);
}
开发者ID:aaronjheng,项目名称:grpc,代码行数:57,代码来源:histogram_test.c


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