这篇教程C++ sput_fail_unless函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sput_fail_unless函数的典型用法代码示例。如果您正苦于以下问题:C++ sput_fail_unless函数的具体用法?C++ sput_fail_unless怎么用?C++ sput_fail_unless使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sput_fail_unless函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: hncp_io_sendtossize_t hncp_io_sendto(hncp o, void *buf, size_t len, const char *ifname, const struct in6_addr *dst){ if (check_send) { sput_fail_unless(o, "hncp"); sput_fail_unless(o && o->udp_socket == 1, "hncp_io ready"); smock_pull_string_is("sendto_ifname", ifname); struct in6_addr *e_dst = smock_pull("sendto_dst"); sput_fail_unless(e_dst && memcmp(e_dst, dst, sizeof(*dst)) == 0, "dst match"); /* Two optional verification steps.. */ if (_smock_get_queue("sendto_len", false)) { int r_len = smock_pull_int("sendto_len"); sput_fail_unless(r_len == (int) len, "len"); } if (_smock_get_queue("sendto_buf", false)) { unsigned char *r = smock_pull("sendto_buf"); sput_fail_unless(memcmp(r, buf, len), "buf"); } return smock_pull_int("sendto_return"); } else { want_send++; return 1; }}
开发者ID:dtaht,项目名称:hnetd,代码行数:30,
示例2: test_intlist_removeallstatic void test_intlist_removeall(void){ intlist_t list = intlist_construct(10); /* Initialize list to [0, 2, 4, 6, 8] */ for (int i = 0; i < 5; i++) { list = intlist_append(list, 2 * i); } list = intlist_removeall(list); sput_fail_unless(intlist_size(list) == 0, "list = intlist_construct(10),/n" "Initialized list to [0 2 4 6 8],/n" "list = intlist_removeall(list)/n" "Verifying list size is now 0"); sput_fail_unless(intlist_capacity(list) == 10, "Verifying list capacity remains 10"); sput_fail_unless(list.elems != NULL, "Verifying list.elems != NULL"); intlist_destroy(list);}
开发者ID:dustan1,项目名称:Things,代码行数:25,
示例3: test_increase_capacitystatic void test_increase_capacity(void){ /* Initialize a new list to [4, 7, 3, -2, 9] */ intlist_t list = intlist_construct(5); list = intlist_append(list, 4); list = intlist_append(list, 7); list = intlist_append(list, 3); list = intlist_append(list, -2); list = intlist_append(list, 9); int *old_array = list.elems; /* Increase the list's capacity from 5 to 10. */ list = increase_capacity(list, 10); sput_fail_unless(list.capacity == 10, "list = intlist_construct(10);/n" "Initialized list to [4 7 3 -2 9]/n" "list = increase_capacity(list, 10)/n" "Verifying list capacity increased from 5 to 10"); sput_fail_unless(list.elems != old_array, "Verifying that a new array was allocated"); int expected[] = {4, 7, 3, -2, 9}; sput_fail_unless(compare_arrays(list.elems, expected, 5), "Verifying that list still contains [4 7 3 -2 9]"); intlist_destroy(list);}
开发者ID:dustan1,项目名称:Things,代码行数:29,
示例4: test_histogram__capacityvoid test_histogram__capacity(void){ static const size_t HISTO_CAP = USHRT_MAX; struct brubeck_histo h; struct brubeck_histo_sample sample; size_t j; memset(&h, 0x0, sizeof(h)); for (j = 0; j < HISTO_CAP + 500; ++j) brubeck_histo_push(&h, (double)(j + 1), 1.0); sput_fail_unless(h.size == HISTO_CAP, "histogram size"); sput_fail_unless(h.count == (HISTO_CAP + 500), "histogram value count"); brubeck_histo_sample(&sample, &h); sput_fail_unless(sample.min == 1.0, "sample.min"); sput_fail_unless(sample.max == (double)HISTO_CAP, "sample.max"); sput_fail_unless(sample.count == (HISTO_CAP + 500), "sample.count"); for (j = 0; j < HISTO_CAP + 500; ++j) brubeck_histo_push(&h, (double)(j + 1), 10.0); sput_fail_unless(h.size == HISTO_CAP, "histogram size"); sput_fail_unless(h.count == ((HISTO_CAP + 500) * 10), "histogram value count"); brubeck_histo_sample(&sample, &h); sput_fail_unless(sample.min == 1.0, "sample.min"); sput_fail_unless(sample.max == (double)HISTO_CAP, "sample.max"); sput_fail_unless(sample.count == ((HISTO_CAP + 500) * 10), "sample.count");}
开发者ID:Slach,项目名称:brubeck,代码行数:34,
示例5: secure_comparator_test void secure_comparator_test(){ std::string shared_secret_a("shared_secret"); std::string shared_secret_b("shared_secret"); themispp::secure_comparator_t a(STR_2_VEC(shared_secret_a)); themispp::secure_comparator_t b(STR_2_VEC(shared_secret_b)); std::vector<uint8_t> buf; buf=a.init(); buf=b.proceed(buf); buf=a.proceed(buf); buf=b.proceed(buf); buf=a.proceed(buf); sput_fail_unless(a.get(), "a ready", __LINE__); sput_fail_unless(b.get(), "b ready", __LINE__); std::string shared_secret_c("shared_secret_c"); std::string shared_secret_d("shared_secret_d"); themispp::secure_comparator_t c(STR_2_VEC(shared_secret_c)); themispp::secure_comparator_t d(STR_2_VEC(shared_secret_d)); buf=c.init(); buf=d.proceed(buf); buf=c.proceed(buf); buf=d.proceed(buf); buf=c.proceed(buf); sput_fail_unless(!(c.get()), "c ready", __LINE__); sput_fail_unless(!(d.get()), "d ready", __LINE__); }
开发者ID:Lagovas,项目名称:themis,代码行数:33,
示例6: test_intlist_getstatic void test_intlist_get(void){ intlist_t list = intlist_construct(10); /* Initialize list to [0, 2, 4, 6, 8] */ for (int i = 0; i < 5; i++) { list = intlist_append(list, 2 * i); } sput_fail_unless(intlist_get(list, 0) == 0, "list = intlist_construct(10),/n" "Initialized list to [0 2 4 6 8],/n" "Verifying intlist_get(list, 0) returns 0"); sput_fail_unless(intlist_get(list, 1) == 2, "Verifying intlist_get(list, 1) returns 2"); sput_fail_unless(intlist_get(list, 2) == 4, "Verifying intlist_get(list, 2) returns 4"); sput_fail_unless(intlist_get(list, 3) == 6, "Verifying intlist_get(list, 3) returns 6"); sput_fail_unless(intlist_get(list, 4) == 8, "Verifying intlist_get(list, 4) returns 8"); intlist_destroy(list);}
开发者ID:dustan1,项目名称:Things,代码行数:28,
示例7: secure_session_test void secure_session_test(){ std::string mes("the test message"); callback client_callbacks; std::string client_id("client"); std::string server_id("server"); themispp::secure_session_t client(std::vector<uint8_t>(client_id.c_str(), client_id.c_str()+client_id.length()), std::vector<uint8_t>(client_priv, client_priv+sizeof(client_priv)), &client_callbacks); callback server_callbacks; themispp::secure_session_t server(std::vector<uint8_t>(server_id.c_str(), server_id.c_str()+server_id.length()), std::vector<uint8_t>(server_priv, server_priv+sizeof(server_priv)), &server_callbacks); std::vector<uint8_t> control_msg1=client.init(); std::vector<uint8_t> control_msg2=server.unwrap(control_msg1); std::vector<uint8_t> control_msg3=client.unwrap(control_msg2); std::vector<uint8_t> control_msg4=server.unwrap(control_msg3); std::vector<uint8_t> control_msg5=client.unwrap(control_msg4); sput_fail_unless(server.is_established(), "server ready", __LINE__); sput_fail_unless(client.is_established(), "client ready", __LINE__); std::vector<uint8_t> msg1=client.wrap(std::vector<uint8_t>(mes.c_str(), mes.c_str()+mes.length()+1)); std::vector<uint8_t> msg2=server.unwrap(msg1); sput_fail_unless(strcmp(mes.c_str(), (const char*)(&msg2[0]))==0, "server get message", __LINE__); std::vector<uint8_t> msg3=server.wrap(std::vector<uint8_t>(mes.c_str(), mes.c_str()+mes.length()+1)); std::vector<uint8_t> msg4=client.unwrap(msg3); sput_fail_unless(strcmp(mes.c_str(), (const char*)(&msg4[0]))==0, "client get message", __LINE__); }
开发者ID:Lagovas,项目名称:themis,代码行数:27,
示例8: dncp_ext_readablevoid dncp_ext_readable(dncp o){ char buf[1024]; size_t len = sizeof(buf); int r; struct sockaddr_in6 *src, *dst; dncp_ep ep; int flags; r = o->ext->cb.recv(o->ext, &ep, &src, &dst, &flags, buf, len); smock_pull_int_is("dncp_poll_io_recvfrom", r); if (r >= 0) { void *b = smock_pull("dncp_poll_io_recvfrom_buf"); char *ifn = smock_pull("dncp_poll_io_recvfrom_ifname"); struct sockaddr_in6 *esrc = smock_pull("dncp_poll_io_recvfrom_src"); struct sockaddr_in6 *edst = smock_pull("dncp_poll_io_recvfrom_dst"); sput_fail_unless(memcmp(b, buf, r)==0, "buf mismatch"); sput_fail_unless(strcmp(ifn, ep->ifname) == 0, "ifname mismatch"); sput_fail_unless(memcmp(src, esrc, sizeof(*src))==0, "src mismatch"); sput_fail_unless(memcmp(&dst->sin6_addr, &edst->sin6_addr, sizeof(dst->sin6_addr))==0, "dst mismatch"); if (!--pending_packets) uloop_end(); }}
开发者ID:dot-Sean,项目名称:hnetd,代码行数:28,
示例9: test_modified_intlist_appendstatic void test_modified_intlist_append(void){ int expected[] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20}; /* Construct a list with capacity 10 and fill it. */ intlist_t list = intlist_construct(10); for (int i = 0; i < 10; i += 1) { list = intlist_append(list, i * 2); } /* Now append an integer to the full list.*/ list = intlist_append(list, 20); sput_fail_unless(compare_arrays(list.elems, expected, 11), "list = intlist_construct(10);/n" "Initialized list to [0 2 4 6 8 10 12 14 16 18]/n" "list = intlist_append(list, 20);/n" "Verifying list is now [0 2 4 6 8 10 12 14 16 18 20]"); sput_fail_unless(list.size == 11, "Verifying list size is now 11"); sput_fail_unless(list.capacity == 20, "Verifying list capacity is now 20"); intlist_destroy(list);}
开发者ID:dustan1,项目名称:Things,代码行数:27,
示例10: hncp_io_set_ifname_enabledbool hncp_io_set_ifname_enabled(hncp o, const char *ifname, bool enabled){ sput_fail_unless(o, "hncp"); sput_fail_unless(o && o->udp_socket == 1, "hncp_io ready"); smock_pull_string_is("set_enable_ifname", ifname); smock_pull_bool_is("set_enable_enabled", enabled); return smock_pull_bool("set_enable_result");}
开发者ID:dtaht,项目名称:hnetd,代码行数:8,
示例11: dummy_node_cbstatic void dummy_node_cb(hncp_subscriber s, hncp_node n, bool add){ L_NOTICE("node callback %s %s", HNCP_NODE_REPR(n), add ? "add" : "remove"); sput_fail_unless(s, "subscriber provided"); sput_fail_unless(s->node_change_callback == dummy_node_cb, "node cb set"); sput_fail_unless(n, "node set"); smock_pull_bool_is("node_callback", add);}
开发者ID:dtaht,项目名称:hnetd,代码行数:9,
示例12: TestAddMemoryvoid TestAddMemory() { GameProperties testGame; testGame = createGame(); addMemory(100); sput_fail_unless(getAvailableMemory() == 100,"Adding MEmory"); sput_fail_unless(addMemory(-100) == 0,"Adding Negative Memory"); free(testGame);}
开发者ID:mtalu,项目名称:Bash_Defender_Group_Project,代码行数:9,
示例13: CreateGameTestvoid CreateGameTest() { GameProperties testGame; testGame = getGame(NULL); sput_fail_unless(getAvailableMemory() == 1000,"Initializing Memory"); //sput_fail_unless(getWave(testGame) == 3,"Initializing WaveNo"); sput_fail_unless(getTotalWaveNo() == 3,"Total Wave Number set to 3 from level file"); sput_fail_unless(getHealth(testGame) == 100,"Initializing Health");}
开发者ID:mtalu,项目名称:Bash_Defender_Group_Project,代码行数:9,
示例14: testlastActionvoid testlastAction() { GameProperties newGame = getGame(NULL); delayGame(ACTIONCOOLDOWN); sput_fail_unless(lastAction(newGame) == 1,"Checking delay more than Cooldown returns true"); delayGame(ACTIONCOOLDOWN-1); sput_fail_unless(lastAction(newGame) == 0,"Checking delay less than Cooldown returns false");}
开发者ID:mtalu,项目名称:Bash_Defender_Group_Project,代码行数:9,
示例15: testSetLastActionvoid testSetLastAction() { GameProperties newGame = getGame(NULL); clock_t currTime = clock()/CLOCKS_PER_SEC; delayGame(2); sput_fail_unless(setlastAction(newGame) == (currTime + 2),"Setting Last Action to current time"); delayGame(2); sput_fail_unless(setlastAction(newGame) == (currTime + 4),"Setting Last Action to current time");}
开发者ID:mtalu,项目名称:Bash_Defender_Group_Project,代码行数:9,
示例16: testStartNextWavevoid testStartNextWave() { setCurrWaveNum(getGame(NULL)->currWaveNo+1); increaseEnemyNumbersThisWave(10); getGame(NULL)->deathCount = 0; sput_fail_unless(startNextWave() == 0, "Invalid: 10 enemies have not registered as dead yet"); getGame(NULL)->deathCount = 10; sput_fail_unless(startNextWave() == 1, "Valid: 10 enemies have registered as dead");}
开发者ID:mtalu,项目名称:Bash_Defender_Group_Project,代码行数:9,
示例17: try_parsestatic void try_parse(struct brubeck_statsd_msg *msg, const char *msg_text, int expect_parse, double expected){ char buffer[64]; strcpy(buffer, msg_text); sput_fail_unless(brubeck_statsd_msg_parse(msg, buffer) == expect_parse, msg_text); if(0 == expect_parse) { sput_fail_unless(expected == msg->value.n, "msg.value.n == expected"); }}
开发者ID:znull,项目名称:brubeck,代码行数:10,
示例18: CreateGameTestvoid CreateGameTest() { GameProperties testGame; testGame = createGame(); sput_fail_if((createGame()) == NULL,"Creating Game"); sput_fail_unless(getAvailableMemory(testGame) == 0,"Initializing Memory"); sput_fail_unless(getWave(testGame) == 0,"Initializing WaveNo"); sput_fail_unless(getHealth(testGame) == 0,"Initializing Health"); free(testGame);}
开发者ID:Vladonchik,项目名称:BashDefenderV2,代码行数:10,
示例19: TestUseMemoryvoid TestUseMemory() { GameProperties testGame; testGame = createGame(); testGame->totalMemory = 100; useMemory(testGame,50); sput_fail_unless(getAvailableMemory() == 50,"Subtracting Memory"); sput_fail_unless(useMemory(testGame,100) == 0,"Subtracting too much Memory"); free(testGame);}
开发者ID:mtalu,项目名称:Bash_Defender_Group_Project,代码行数:10,
示例20: try_parse_setstatic void try_parse_set(struct brubeck_statsd_msg *msg, const char *msg_text, int expect_parse, const char *expected){ char buffer[64]; strcpy(buffer, msg_text); sput_fail_unless(brubeck_statsd_msg_parse(msg, buffer) == expect_parse, msg_text); if(0 == expect_parse) { sput_fail_unless(0 == strcmp(msg->value.s, expected), "msg.value.s == expected"); }}
开发者ID:znull,项目名称:brubeck,代码行数:10,
示例21: Test_CRCvoid Test_CRC(){ const char *buffer = "123456789"; uint32_t crc = 0; crc = crc32((uint32_t)0L, (unsigned char *)buffer, (size_t)9); sput_fail_unless(crc == 0xCBF43926, "crc32 check"); crc = crc32(0L, (unsigned char *)NULL, (size_t)1); sput_fail_unless(crc == 0, "crc32 check");}
开发者ID:kunyuan,项目名称:Feynman_Simulator,代码行数:10,
示例22: testlastActionvoid testlastAction() { GameProperties newGame = createGame(); delayGame(ACTIONCOOLDOWN); sput_fail_unless(lastAction(newGame) == 1,"Checking delay more than Cooldown returns true"); delayGame(ACTIONCOOLDOWN-1); sput_fail_unless(lastAction(newGame) == 0,"Checking delay less than Cooldown returns false"); free(newGame->clock); free(newGame);}
开发者ID:Vladonchik,项目名称:BashDefenderV2,代码行数:11,
示例23: dummy_local_tlv_cbstatic void dummy_local_tlv_cb(hncp_subscriber s, struct tlv_attr *tlv, bool add){ sput_fail_unless(s, "subscriber provided"); sput_fail_unless(s->local_tlv_change_callback == dummy_local_tlv_cb, "tlv cb set"); sput_fail_unless(tlv, "tlv set"); L_NOTICE("local tlv callback %s %s", TLV_REPR(tlv), add ? "add" : "remove"); if (tlv_id(tlv) == HNCP_T_VERSION) return; int exp_v = (add ? 1 : -1) * tlv_id(tlv); smock_pull_int_is("local_tlv_callback", exp_v);}
开发者ID:dtaht,项目名称:hnetd,代码行数:12,
示例24: test_gettm_failstatic void test_gettm_fail(){ Task task; task.description = "(A) do hw START: bob"; sput_fail_unless(gettms(&task) == NULL, "gettm(): start fail test"); task.description = "(A) do hw END: bob"; sput_fail_unless(gettms(&task) == NULL, "gettm(): end fail test"); task.description = "(A) do hw START: bob END: larry"; sput_fail_unless(gettms(&task) == NULL, "gettm(): end fail test");}
开发者ID:theNerd247,项目名称:yadp,代码行数:12,
示例25: test_fls64void test_fls64(){ sput_fail_unless(bit_fls(0ull)==-1, "Edge case: arg=0"); sput_fail_unless(bit_fls(1ull)==0, "arg=1"); sput_fail_unless(bit_fls(0xFFFFFFFFFFFFFFFFull)==63, "arg=0xFFFFFFFF"); sput_fail_unless(bit_ffs(0x8000000000000000ull)==63, "arg=0x8000000000000000"); for (uint64_t i=0; i<64; ++i) { sput_fail_unless(bit_fls(1ull<<i)==i, "General Test"); sput_fail_unless(bit_fls(0xFFFFFFFFFFFFFFFFull>>i)==63-i, "General test1"); }}
开发者ID:sopyer,项目名称:Infinity,代码行数:13,
示例26: test_fls32void test_fls32(){ sput_fail_unless(bit_fls(0u)==-1, "Edge case: arg=0"); sput_fail_unless(bit_fls(1u)==0, "arg=1"); sput_fail_unless(bit_fls(0xFFFFFFFFu)==31, "arg=0xFFFFFFFF"); sput_fail_unless(bit_fls(0x80000000u)==31, "arg=0x80000000"); for (uint32_t i=0; i<32; ++i) { sput_fail_unless(bit_fls(1u<<i)==i, "General Test0"); sput_fail_unless(bit_fls(0xFFFFFFFFu>>i)==31-i, "General test1"); }}
开发者ID:sopyer,项目名称:Infinity,代码行数:13,
示例27: hncp_io_schedulevoid hncp_io_schedule(hncp o, int msecs){ if (check_timing) { sput_fail_unless(o, "hncp"); sput_fail_unless(o && o->udp_socket == 1, "hncp_io ready"); smock_pull_int_is("schedule", msecs); } else { want_schedule = msecs; }}
开发者ID:dtaht,项目名称:hnetd,代码行数:13,
示例28: prefix_contains_tvoid prefix_contains_t(void){ sput_fail_if(prefix_contains(&p1, &p2), "p1 and p2 are disjoint"); sput_fail_if(prefix_contains(&p2, &p1), "p1 and p2 are disjoint"); sput_fail_unless(prefix_contains(&p1, &p11), "p1 contains p11"); sput_fail_unless(prefix_contains(&p1, &p1f), "p1 contains p1f"); sput_fail_if(prefix_contains(&p2, &p11), "p2 do not contain p11");}
开发者ID:dtaht,项目名称:hnetd,代码行数:13,
示例29: test_intlist_constructstatic void test_intlist_construct(void){ intlist_t list = intlist_construct(10); sput_fail_unless(list.capacity == 10, "list = intlist_construct(10),/n" "Verifying list.capacity == 10"); sput_fail_unless(list.size == 0, "Verifying list.size == 0"); sput_fail_unless(list.elems != NULL, "Verifying list.elems is not NULL"); intlist_destroy(list);}
开发者ID:dustan1,项目名称:Things,代码行数:13,
示例30: Test_createEnemy/** creates two enemies and checks their defaut values*/void Test_createEnemy(){ freeAllEnemies(); createEnemy(); sput_fail_unless(getNumberOfEnemies() == 1, "Valid: Number of enemies held in group is one."); sput_fail_unless(getEnemyHealth(getNumberOfEnemies()) == 100,"Valid: Enemy health is default." ); createEnemy(); sput_fail_unless(getNumberOfEnemies() == 2, "Valid: Number of enemies held in group is two."); sput_fail_unless(getEnemyHealth(getNumberOfEnemies()) == 100,"Valid: Enemy 2 health is default." );}
开发者ID:mtalu,项目名称:Bash_Defender_Group_Project,代码行数:17,
注:本文中的sput_fail_unless函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sputc函数代码示例 C++ spurious_interrupt函数代码示例 |