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


C++ CU_ASSERT_FALSE函数代码示例

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


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

示例1: testSchedulerCheck

static void testSchedulerCheck (void)
{
	std::string s_one("one");
	std::string s_two("two");
	std::string s_three("three");
	std::string s_four("four");
	std::string s_five("five");

	ScheduleEventPtr three = Schedule_Event(4, nullptr, nullptr, nullptr, static_cast<void*>(&s_three));
	ScheduleEventPtr four = Schedule_Event(4, nullptr, nullptr, nullptr, static_cast<void*>(&s_four));
	ScheduleEventPtr five = Schedule_Event(4, nullptr, nullptr, nullptr, static_cast<void*>(&s_five));
	ScheduleEventPtr one = Schedule_Event(3, nullptr, delayCheck, nullptr, static_cast<void*>(&s_one));
	ScheduleEventPtr two = Schedule_Event(3, nullptr, nullptr, nullptr, static_cast<void*>(&s_two));

	ScheduleEventPtr e = Dequeue_Event(1);
	CU_ASSERT_FALSE(e);
	e = Dequeue_Event(2);
	CU_ASSERT_FALSE(e);
	/* one is delayed via check function - so we get the 2nd event at the first dequeue here */
	e = Dequeue_Event(3);
	CU_ASSERT_EQUAL_FATAL(e, two);
	/* now we are ready for the 1st event */
	e = Dequeue_Event(5);
	CU_ASSERT_EQUAL_FATAL(e, one);
	/* the remaining events are in order */
	e = Dequeue_Event(5);
	CU_ASSERT_EQUAL_FATAL(e, three);
	e = Dequeue_Event(5);
	CU_ASSERT_EQUAL_FATAL(e, four);
	e = Dequeue_Event(5);
	CU_ASSERT_EQUAL_FATAL(e, five);
}
开发者ID:cigo,项目名称:ufoai,代码行数:32,代码来源:test_events.cpp

示例2: test_hashMap_containsValue

void test_hashMap_containsValue(void) {
    char * key = "key";
    char * value = "value";
    char * key2 = "key2";
    char * value2 = "value2";
    char * neValue = "notExisting";
    char * key3 = "key3";
    char * value3 = NULL;

    hashMap_clear(map, false, false);

    // Add one entry
    hashMap_put(map, key, value);

    // Add second entry
    hashMap_put(map, key2, value2);

    CU_ASSERT_TRUE(hashMap_containsValue(map, value));
    CU_ASSERT_TRUE(hashMap_containsValue(map, value2));
    CU_ASSERT_FALSE(hashMap_containsValue(map, neValue));
    CU_ASSERT_FALSE(hashMap_containsValue(map, NULL));

    // Add third entry with NULL value
    hashMap_put(map, key3, value3);

    CU_ASSERT_TRUE(hashMap_containsValue(map, value3));
}
开发者ID:ecros,项目名称:celix,代码行数:27,代码来源:hash_map_test.c

示例3: change_expires

static void change_expires(){
	LinphoneCoreManager* lcm = create_lcm();
	stats* counters = &lcm->stat;
	LinphoneProxyConfig* proxy_config;
	register_with_refresh_base(lcm->lc,FALSE,NULL,NULL);

	linphone_core_get_default_proxy(lcm->lc,&proxy_config);

	linphone_proxy_config_edit(proxy_config);
	reset_counters(counters); /*clear stats*/

	/*nothing is supposed to arrive until done*/
	CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));

	linphone_proxy_config_set_expires(proxy_config,3);

	linphone_proxy_config_done(proxy_config);
	CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
	/*wait 2s without receive refresh*/
	CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2,2000));
	/* now, it should be ok*/
	CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2));


	linphone_core_manager_destroy(lcm);
}
开发者ID:xiaolds,项目名称:VideoCallVoIP,代码行数:26,代码来源:register_tester.c

示例4: test_compareStrAndNum

static void test_compareStrAndNum() {
    int32_t num;

    CU_ASSERT_TRUE(compareStrAndNum("abcd", 1, "afgh", 1, NULL));
    CU_ASSERT_TRUE(compareStrAndNum("ABCD", 4, "abcd", 4, NULL));
    CU_ASSERT_TRUE(compareStrAndNum("AbCd", 3, "AbCE", 3, NULL));
    CU_ASSERT_TRUE(compareStrAndNum("ABCD", 1, "a", 1, NULL));

    CU_ASSERT_FALSE(compareStrAndNum("abcd", 1, "efgh", 1, NULL));
    CU_ASSERT_FALSE(compareStrAndNum("ABCD", 4, "abcd", 3, NULL));

    CU_ASSERT_TRUE(compareStrAndNum("abcd", 4, "abcd1", 5, NULL));
    CU_ASSERT_TRUE(compareStrAndNum("abcd", 4, "abcd123", 7, NULL));
    CU_ASSERT_FALSE(compareStrAndNum("abcd", 4, "abcd12A", 7, NULL));
    CU_ASSERT_FALSE(compareStrAndNum("abcd", 4, "abcdB12", 7, NULL));
    CU_ASSERT_FALSE(compareStrAndNum("abdd", 4, "abcd132", 7, NULL));

#define TEST_COMPARE_STR_AND_NUM(s1, l1, s2, l2, v, r)              \
    do {                                                            \
        num = -1;                                                    \
        CU_ASSERT_EQUAL(compareStrAndNum(s1, l1, s2, l2, &num),r);  \
        CU_ASSERT_EQUAL(num, v);                                    \
    } while(0);                                                     \

    TEST_COMPARE_STR_AND_NUM("abcd", 4, "abcd", 4, -1, TRUE);
    TEST_COMPARE_STR_AND_NUM("abcd", 4, "abcd1", 5, 1, TRUE);
    TEST_COMPARE_STR_AND_NUM("abcd", 4, "abcd123", 7, 123, TRUE);
    TEST_COMPARE_STR_AND_NUM("abcd", 4, "abcd12A", 7, -1, FALSE);
    TEST_COMPARE_STR_AND_NUM("abcd", 4, "abcdB12", 7, -1, FALSE);
    TEST_COMPARE_STR_AND_NUM("abdd", 4, "abcd132", 7, -1, FALSE);
}
开发者ID:llahti,项目名称:scpi-parser,代码行数:31,代码来源:test_scpi_utils.c

示例5: test_grid_is_row_complete

void test_grid_is_row_complete()
{
    // Create a grid.
    int numberOfRows = 4;
    int numberOfColumns = 4;
    TrnGrid* grid = trn_grid_new(numberOfRows, numberOfColumns);

    // Last row is void only.
    CU_ASSERT_FALSE( trn_grid_is_row_complete(grid,numberOfRows) );

    // Last row is full.
    TrnPositionInGrid pos;
    int columnIndex;
    pos.rowIndex = numberOfRows-1 ;
    for (columnIndex = 0 ; columnIndex < grid->numberOfColumns ; columnIndex++) {
        pos.columnIndex = columnIndex;
        trn_grid_set_cell(grid, pos, TRN_TETROMINO_I);
    }
    CU_ASSERT_TRUE( trn_grid_is_row_complete(grid,numberOfRows) );

    // Last row is full except last element. 
    pos.rowIndex = numberOfRows-1 ;
    pos.columnIndex = numberOfColumns-1 ;
    trn_grid_set_cell(grid, pos, TRN_TETROMINO_VOID);
    CU_ASSERT_FALSE( trn_grid_is_row_complete(grid,numberOfRows) );
}
开发者ID:FredericN,项目名称:tetrinria,代码行数:26,代码来源:test_tetrinria_core.c

示例6: nomls_tests

void nomls_tests()
{
	size_t first_diff = 0;
	int test_result;
	unchanged_users_v = apol_vector_create(free);
	changed_users_v = apol_vector_create(free);

	apol_vector_t *correct_unchanged_users_v = string_array_to_vector(nomls_unchanged_users);
	apol_vector_t *correct_changed_users_v = string_array_to_vector(nomls_changed_users);

	build_nomls_vecs();
	apol_vector_sort(unchanged_users_v, compare_str, NULL);
	apol_vector_sort(correct_unchanged_users_v, compare_str, NULL);
	CU_ASSERT_FALSE(test_result =
			apol_vector_compare(unchanged_users_v, correct_unchanged_users_v, compare_str, NULL, &first_diff));
	if (test_result) {
		print_test_failure(unchanged_users_v, correct_unchanged_users_v, first_diff, "Unchanged MLS Users");
	}
	apol_vector_sort(changed_users_v, compare_str, NULL);
	apol_vector_sort(correct_changed_users_v, compare_str, NULL);
	CU_ASSERT_FALSE(test_result =
			apol_vector_compare(changed_users_v, correct_changed_users_v, compare_str, NULL, &first_diff));
	if (test_result) {
		print_test_failure(changed_users_v, correct_changed_users_v, first_diff, "Changed MLS Users");
	}
	apol_vector_destroy(&unchanged_users_v);
	apol_vector_destroy(&changed_users_v);
	apol_vector_destroy(&correct_unchanged_users_v);
	apol_vector_destroy(&correct_changed_users_v);

}
开发者ID:0xroot,项目名称:setools3,代码行数:31,代码来源:nomls-tests.c

示例7: test_string_ends_with

static void test_string_ends_with() {
	CU_ASSERT_TRUE(string_ends_with("MiArchivo.txt", "txt"));
	CU_ASSERT_TRUE(string_ends_with("MiArchivo.txt", "MiArchivo.txt"));
	CU_ASSERT_FALSE(string_ends_with("MiArchivo.doc", "txt"));
	CU_ASSERT_FALSE(string_ends_with("MiDoc", "txt"));
	CU_ASSERT_FALSE(string_ends_with("", "txt"));
}
开发者ID:nnico15m,项目名称:so-commons-library,代码行数:7,代码来源:test_string.c

示例8: testNTH

void testNTH()
{
    list_t *l = list_new();
    for (int i = 0; i < 100; ++i)
        {
            int *x = malloc(sizeof(int));
            *x = i;
            list_add(l, x);
        }

    int *x;

    for (int i = 0; i < 100; ++i)
        {
            CU_ASSERT(list_nth(l, i, (void **)&x));
            CU_ASSERT_EQUAL(*x, i);
        }

    CU_ASSERT_FALSE(list_nth(l, -1, (void **)&x));
    CU_ASSERT_EQUAL(x, NULL);
    CU_ASSERT_FALSE(list_nth(l, 100, (void **)&x));
    CU_ASSERT_EQUAL(x, NULL);

    list_foreach(l, free);
    list_free(l);
}
开发者ID:JohanWindahl,项目名称:ioopm15,代码行数:26,代码来源:list_test.c

示例9: test_string_starts_with

static void test_string_starts_with() {
	CU_ASSERT_TRUE(string_starts_with("#Comentario", "#"));
	CU_ASSERT_TRUE(string_starts_with("Comentario", "Comen"));
	CU_ASSERT_FALSE(string_starts_with("Comentario", "comen"));
	CU_ASSERT_FALSE(string_starts_with("Comentario", "lala"));
	CU_ASSERT_FALSE(string_starts_with("", "#"));
}
开发者ID:nnico15m,项目名称:so-commons-library,代码行数:7,代码来源:test_string.c

示例10: testUriComponentsChecker

/*
 * From 19.1.1 SIP and SIPS URI Components
 * 									   				dialog
										reg./redir. Contact/
			default  Req.-URI  To  From  Contact   R-R/Route  external
user          --          o      o    o       o          o         o
password      --          o      o    o       o          o         o
host          --          m      m    m       m          m         m
port          (1)         o      -    -       o          o         o
user-param    ip          o      o    o       o          o         o
method        INVITE      -      -    -       -          -         o
maddr-param   --          o      -    -       o          o         o
ttl-param     1           o      -    -       o          -         o
transp.-param (2)         o      -    -       o          o         o
lr-param      --          o      -    -       -          o         o
other-param   --          o      o    o       o          o         o
headers       --          -      -    -       o          -         o*/
void testUriComponentsChecker() {
	belle_sip_uri_t* uri = belle_sip_uri_parse("sip:hostonly");
	CU_ASSERT_TRUE(belle_sip_uri_check_components_from_request_uri(uri));
	belle_sip_object_unref(uri);

	{
	belle_sip_header_from_t*	header = belle_sip_header_from_parse("From: sip:linphone.org:5061");
	CU_ASSERT_FALSE(belle_sip_uri_check_components_from_context(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(header)),NULL,"From"));
	belle_sip_object_unref(header);
	}
	{
	belle_sip_header_to_t*	header = belle_sip_header_to_parse("To: sip:linphone.org?header=interdit");
	CU_ASSERT_FALSE(belle_sip_uri_check_components_from_context(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(header)),NULL,"To"));
	belle_sip_object_unref(header);
	}
	{
	belle_sip_header_contact_t*	header = belle_sip_header_contact_parse("Contact: <sip:linphone.org;lr>");
	CU_ASSERT_FALSE(belle_sip_uri_check_components_from_context(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(header)),"REGISTER","Contact"));
	CU_ASSERT_TRUE(belle_sip_uri_check_components_from_context(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(header)),NULL,"Contact"));
	belle_sip_object_unref(header);
	}
	{
	belle_sip_header_record_route_t*	header = belle_sip_header_record_route_parse("Record-Route: <sip:linphone.org;ttl=interdit>");
	CU_ASSERT_FALSE(belle_sip_uri_check_components_from_context(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(header)),NULL,"Record-Route"));
	belle_sip_object_unref(header);
	}
	{
	belle_sip_uri_t* uri = belle_sip_uri_parse("sip:linphone.org:5061?header=toto");
	CU_ASSERT_TRUE(belle_sip_uri_check_components_from_context(uri,NULL,"Any"));
	belle_sip_object_unref(uri);
	}
}
开发者ID:Gui13,项目名称:belle-sip,代码行数:49,代码来源:belle_sip_uri_tester.c

示例11: test_error_level

void test_error_level() {
	CU_ASSERT_TRUE(set_log_lvl(ERROR));
	char *test_msg = "Test msg";
	int deep = 1;
	CU_ASSERT_FALSE(debug(deep, test_msg));
	CU_ASSERT_FALSE(info(deep, test_msg));
	CU_ASSERT_FALSE(warn(deep, test_msg));
	CU_ASSERT_TRUE(error(deep, test_msg));
}
开发者ID:jorgemtnz,项目名称:simpleFileServer,代码行数:9,代码来源:logger-test.c

示例12: test_is_multicast

static void test_is_multicast(void) {

	CU_ASSERT_TRUE(ms_is_multicast("224.1.2.3"));
	CU_ASSERT_TRUE(ms_is_multicast("239.0.0.0"));
	CU_ASSERT_TRUE(ms_is_multicast("ff02::3:2"));
	CU_ASSERT_FALSE(ms_is_multicast("192.68.0.1"));
	CU_ASSERT_FALSE(ms_is_multicast("::1"));

}
开发者ID:tiena2cva,项目名称:Linphone,代码行数:9,代码来源:mediastreamer2_framework_tester.c

示例13: xmms_metadata_test_xform_init

static gboolean
xmms_metadata_test_xform_init (xmms_xform_t *xform)
{
	const gchar *musicbrainz_va_id = "89ad4ac3-39f7-470e-963a-56509c546377";
	const gchar *title, *rpgain;
	gint track, totaltracks, compilation;

	CU_ASSERT_FALSE (xmms_xform_metadata_mapper_match (xform, "missing", "missing", -1));

	/* Basic string mapping */
	CU_ASSERT_TRUE (xmms_xform_metadata_mapper_match (xform, "title", "the title", -1));
	CU_ASSERT_TRUE (xmms_xform_metadata_get_str (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_TITLE, &title));
	CU_ASSERT_STRING_EQUAL ("the title", title);

	/* Mapping track number, without total tracks */
	CU_ASSERT_TRUE (xmms_xform_metadata_mapper_match (xform, "tracknr", "1", -1));
	CU_ASSERT_TRUE (xmms_xform_metadata_get_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_TRACKNR, &track));
	CU_ASSERT_FALSE (xmms_xform_metadata_get_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_TOTALTRACKS, &totaltracks));
	CU_ASSERT_EQUAL (1, track);

	/* Mapping track number, with total tracks */
	CU_ASSERT_TRUE (xmms_xform_metadata_mapper_match (xform, "tracknr", "1/10", -1));
	CU_ASSERT_TRUE (xmms_xform_metadata_get_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_TRACKNR, &track));
	CU_ASSERT_TRUE (xmms_xform_metadata_get_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_TOTALTRACKS, &totaltracks));
	CU_ASSERT_EQUAL (1, track);
	CU_ASSERT_EQUAL (10, totaltracks);

	/* Broken track number */
	CU_ASSERT_FALSE (xmms_xform_metadata_mapper_match (xform, "tracknr", "bad", -1));

	/* Mapping compilation indicator to boolean compilation */
	CU_ASSERT_TRUE (xmms_xform_metadata_mapper_match (xform, "compilation", "1", -1));
	CU_ASSERT_TRUE (xmms_xform_metadata_get_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_COMPILATION, &compilation));
	CU_ASSERT_EQUAL (TRUE, compilation);

	/* Mapping compilation indicator to boolean compilation */
	CU_ASSERT_TRUE (xmms_xform_metadata_mapper_match (xform, "compilation", musicbrainz_va_id, -1));
	CU_ASSERT_TRUE (xmms_xform_metadata_get_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_COMPILATION, &compilation));
	CU_ASSERT_EQUAL (TRUE, compilation);


	/* Mapping replaygain to the format the replaygain xform expects */
	CU_ASSERT_TRUE (xmms_xform_metadata_mapper_match (xform, "replaygain_track_gain", "-14.69", -1));
	CU_ASSERT_TRUE (xmms_xform_metadata_get_str (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_GAIN_TRACK, &rpgain));
	CU_ASSERT_STRING_EQUAL ("0.18428", rpgain);
	CU_ASSERT_TRUE (xmms_xform_metadata_mapper_match (xform, "replaygain_track_gain", "-14.69 dB", -1));
	CU_ASSERT_TRUE (xmms_xform_metadata_get_str (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_GAIN_TRACK, &rpgain));
	CU_ASSERT_STRING_EQUAL ("0.18428", rpgain);


	CU_ASSERT_TRUE (xmms_xform_metadata_mapper_match (xform, "coverart", "test", 10));

	xmms_xform_outdata_type_add (xform, XMMS_STREAM_TYPE_MIMETYPE, "audio/pcm", XMMS_STREAM_TYPE_END);

	return TRUE;
}
开发者ID:chrippa,项目名称:xmms2,代码行数:56,代码来源:t_xform.c

示例14: test_compareStr

static void test_compareStr() {

    CU_ASSERT_TRUE(compareStr("abcd", 1, "afgh", 1));
    CU_ASSERT_TRUE(compareStr("ABCD", 4, "abcd", 4));
    CU_ASSERT_TRUE(compareStr("AbCd", 3, "AbCE", 3));
    CU_ASSERT_TRUE(compareStr("ABCD", 1, "a", 1));

    CU_ASSERT_FALSE(compareStr("abcd", 1, "efgh", 1));
    CU_ASSERT_FALSE(compareStr("ABCD", 4, "abcd", 3));
}
开发者ID:llahti,项目名称:scpi-parser,代码行数:10,代码来源:test_scpi_utils.c

示例15: test_vqec_seq_num_le

static void test_vqec_seq_num_le (void) {
    result = vqec_seq_num_le(5,4);
    CU_ASSERT_FALSE(result);
    result = vqec_seq_num_le(5,5);
    CU_ASSERT(result);
    result = vqec_seq_num_le(5,6);
    CU_ASSERT(result);
    result = vqec_seq_num_le(0xb,0x8000000b);
    CU_ASSERT(result);
    result = vqec_seq_num_le(0xb,0x8000000c);
    CU_ASSERT_FALSE(result);
}
开发者ID:MichaelSchmid,项目名称:cisco-vqe-client,代码行数:12,代码来源:test_vqec_utest_seq_num.c


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