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


C++ CuAssertStrEquals函数代码示例

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


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

示例1: TestCuStringNew

void TestCuStringNew(CuTest* tc)
{
	CuString* str = CuStringNew();
	CuAssertTrue(tc, 0 == str->length);
	CuAssertTrue(tc, 0 != str->size);
	CuAssertStrEquals(tc, "", str->buffer);
}
开发者ID:1tgr,项目名称:cutest,代码行数:7,代码来源:CuTestTest.c

示例2: TestCuSuiteDetails_MultiplePasses

void TestCuSuiteDetails_MultiplePasses(CuTest* tc)
{
	CuSuite ts;
	CuTest tc1, tc2;
	CuString details;
	const char* expected;

	CuSuiteInit(&ts);
	CuTestInit(&tc1, "TestPasses", TestPasses);
	CuTestInit(&tc2, "TestPasses", TestPasses);
	CuStringInit(&details);

	CuSuiteAdd(&ts, &tc1);
	CuSuiteAdd(&ts, &tc2);
	CuSuiteRun(&ts);

	CuSuiteDetails(&ts, &details);

	CuAssertTrue(tc, ts.count == 2);
	CuAssertTrue(tc, ts.failCount == 0);

	expected =
		"OK (2 tests)\n";

	CuAssertStrEquals(tc, expected, details.buffer);
}
开发者ID:1tgr,项目名称:cutest,代码行数:26,代码来源:CuTestTest.c

示例3: test_move_illegal

static void test_move_illegal(CuTest * tc) {
  void (*event_cb)(const char *, ...);
  unit * u;
  region * r, ** path;

  svc.reset();

  event_cb = svc.add_event;
  svc.add_event = record_events;
  num_events = 0;

  r = svc.regions->create(0, 0);
  u = svc.units->create();
  svc.regions->add_unit(r, u);
  kv_seti(&u->stats, "speed", 1);

  path = malloc(sizeof(region *)*2);
  path[0] = svc.regions->create(2, 0);
  path[1] = 0;
  u_set_moves(u, path);

  svc.units->set_region(u, r);
  do_movement();
  CuAssertPtrEquals(tc, r, svc.units->get_region(u));

  CuAssertIntEquals(tc, 1, num_events);
  CuAssertStrEquals(tc, "illegal_move", events[0]);
  svc.add_event = event_cb;
}
开发者ID:ennorehling,项目名称:atlantis-movement,代码行数:29,代码来源:movement_test.c

示例4: TestReverseWithShortString

void TestReverseWithShortString(CuTest *tc) {
  DHString *string = dhstring_new("Hello world!");
  dhstring_reverse_in_place(string);
  const char *actual = dhstring_to_array(string);
  const char *expected = "!dlrow olleH";
  CuAssertStrEquals(tc, expected, actual);
}
开发者ID:dbharris2,项目名称:dhsource,代码行数:7,代码来源:DHStringReverseTests.c

示例5: TestCuStringAppendNULL

void TestCuStringAppendNULL(CuTest* tc)
{
	CuString* str = CuStringNew();
	CuStringAppend(str, NULL);
	CuAssertIntEquals(tc, 4, str->length);
	CuAssertStrEquals(tc, "NULL", str->buffer);
}
开发者ID:1tgr,项目名称:cutest,代码行数:7,代码来源:CuTestTest.c

示例6: TestReverseWithEmptyString

void TestReverseWithEmptyString(CuTest *tc) {
  DHString *string = dhstring_new("");
  dhstring_reverse_in_place(string);
  const char *actual = dhstring_to_array(string);
  const char *expected = "";
  CuAssertStrEquals(tc, expected, actual);
}
开发者ID:dbharris2,项目名称:dhsource,代码行数:7,代码来源:DHStringReverseTests.c

示例7: testSetNormalise

void testSetNormalise(CuTest *tc) {
	char* input;
	char* expected;
	setStatus ss;

	// TODO: Boundary Case - Max number of chars
	// TODO: Boundary Case - Max number of members

	// Boundary Case - 29 chars - Should be OK
	input = strdup("a i a i a i a e a i a a i a i");   expected = "a e i"; 
	ss = setNormalise(input); CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setOK, ss);

	// Boundary Case - 30 chars - ON THE LIMIT - Should return setBadSet
	input = strdup("a i a i a i a e a i a a i a ii");   expected = "a i a i a i a e a i a a i a ii";  // "a e i ii"; 
	ss = setNormalise(input); CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setBadSet, ss);

	// Boundary Case - 9 members - Should be OK
	input = strdup("j i h g e d c b a");   expected = "a b c d e g h i j"; 
	ss = setNormalise(input); CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setOK, ss);

	// Boundary Case - 10 members - Should return setBadSet
	input = strdup("j i h g e d c b a z");   expected = "a b c d e g h i j z"; 
	ss = setNormalise(input); CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setBadSet, ss);

	input = strdup("a i a i h g f e d c b a i a i");   expected = "a b c d e f g h i"; ss = setNormalise(input);
	CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setOK, ss);

	// General Case - duplicates and ordering
	input = strdup("i h g f e d c b a");               expected ="a b c d e f g h i";ss = setNormalise(input);
	CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setOK, ss);

	// General Case - duplicates and ordering
	input = strdup("c c c c c c d a");                 expected = "a c d";           ss = setNormalise(input);
	CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setOK, ss);

	// General Case - duplicates and ordering
	input = strdup("beta alpha beta gamma alpha");     expected = "alpha beta gamma"; ss = setNormalise(input);
	CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setOK, ss);

	// Boundary Case - empty set supplied
	input = strdup("");                                expected = "";                 ss = setNormalise(input);
	CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setOK, ss);

	// Exceptional Case - NULL supplied
	input = NULL;                                      expected = NULL;               ss = setNormalise(input);
	CuAssertStrEquals(tc, expected, input); CuAssertIntEquals(tc, setBadSet, ss);
} //testSetNormalise
开发者ID:mattharg,项目名称:Set_Algebra_String_Functions_in_C,代码行数:47,代码来源:set_misra.c

示例8: test_uri_norm_scheme_2

test_uri_norm_scheme_2(CuTest *tc)
{
	char *seed = strdup("hTTp://www.example.com/test/func.cgi?x=y&z=j");
	uriobj_t uri;
	uri_parse(&uri, re, seed);
	uri_norm_scheme(&uri);
	CuAssertStrEquals(tc, *uri.uri_scheme, "http" );
}
开发者ID:azzmosphere,项目名称:Azzmos-0.1.1,代码行数:8,代码来源:test_uriobj.c

示例9: snprintf_underflow

static void snprintf_underflow(CuTest *tc)
{
    char buf[20];
    int rv;

    rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.0001);
    CuAssertIntEquals(tc, 4, rv);
    CuAssertStrEquals(tc, "0.00", buf);
    
    rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.001);
    CuAssertIntEquals(tc, 4, rv);
    CuAssertStrEquals(tc, "0.00", buf);
    
    rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.01);
    CuAssertIntEquals(tc, 4, rv);
    CuAssertStrEquals(tc, "0.01", buf);
}
开发者ID:kheradmand,项目名称:Break,代码行数:17,代码来源:teststr.c

示例10: test_json_write

static void test_json_write(CuTest * tc) {
    char buf[256];
    cJSON * json = cJSON_CreateObject();
    stream strm;
    mstream_init(&strm);
    cJSON_AddNumberToObject(json, "turn", 1);
    json_write(json, &strm);
    strm.api->rewind(strm.handle);
    strm.api->readln(strm.handle, buf, sizeof(buf));
    CuAssertStrEquals(tc, "{", buf);
    strm.api->readln(strm.handle, buf, sizeof(buf));
    CuAssertStrEquals(tc, "\t\"turn\":\t1", buf);
    strm.api->readln(strm.handle, buf, sizeof(buf));
    CuAssertStrEquals(tc, "}", buf);
    cJSON_Delete(json);
    mstream_done(&strm);
}
开发者ID:stanbery,项目名称:atlantis,代码行数:17,代码来源:server.test.c

示例11: test_spellref

static void test_spellref(CuTest *tc)
{
    spellref *ref;
    spell *sp;
    test_setup();
    ref = spellref_create(NULL, "hodor");
    CuAssertPtrNotNull(tc, ref);
    CuAssertPtrEquals(tc, NULL, ref->sp);
    CuAssertStrEquals(tc, "hodor", ref->_name);
    CuAssertPtrEquals(tc, NULL, spellref_get(ref));
    CuAssertStrEquals(tc, "hodor", spellref_name(ref));
    sp = create_spell("hodor");
    CuAssertPtrNotNull(tc, sp);
    CuAssertPtrEquals(tc, sp, spellref_get(ref));
    spellref_free(ref);
    test_teardown();
}
开发者ID:ennorehling,项目名称:eressea,代码行数:17,代码来源:spell.test.c

示例12: test_codeblock_execute

// -----------------------------------------------------------------------------
// Test: codeblock_execute() -- simple codeblock
// -----------------------------------------------------------------------------
void test_codeblock_execute(CuTest *tc)
{
    Codeblock* cb = codeblock_create();
    cb->ast       = cb_conststr_create("test");
    
    codeblock_execute(cb); // execute codeblock once
    
    CuAssertIntEquals(tc, CB_VT_STRING, cb_value_get_type(cb->result));
    CuAssertStrEquals(tc, "test",       cb_string_get(cb->result));
    
    codeblock_execute(cb); // execute a second time
    
    CuAssertIntEquals(tc, CB_VT_STRING, cb_value_get_type(cb->result));
    CuAssertStrEquals(tc, "test",       cb_string_get(cb->result));
    
    codeblock_free(cb);
}
开发者ID:MaSydJun,项目名称:cbc,代码行数:20,代码来源:codeblock_test.c

示例13: Test_d_string_insert_printf

void Test_d_string_insert_printf(CuTest* tc) {
	char * test = "foo";

	DString * result = d_string_new(test);

	d_string_insert_printf(result, 2, "%dbar%d", 5, 7);
	CuAssertStrEquals(tc, "fo5bar7o", result->str);
	CuAssertIntEquals(tc, 8, result->currentStringLength);

	d_string_insert_printf(result, -1, "z", 5, 7);
	CuAssertStrEquals(tc, "fo5bar7oz", result->str);
	CuAssertIntEquals(tc, 9, result->currentStringLength);

	d_string_insert_printf(NULL, 0, NULL);

	d_string_free(result, true);
}
开发者ID:fletcher,项目名称:c-template,代码行数:17,代码来源:d_string.c

示例14: Test_d_string_prepend

void Test_d_string_prepend(CuTest* tc) {
	char * test = "foo";

	DString * result = d_string_new(test);

	d_string_prepend(result, "bar");
	CuAssertStrEquals(tc, "barfoo", result->str);
	CuAssertIntEquals(tc, 6, result->currentStringLength);

	d_string_prepend(result, NULL);
	CuAssertStrEquals(tc, "barfoo", result->str);
	CuAssertIntEquals(tc, 6, result->currentStringLength);

	d_string_prepend(NULL, "bar");

	d_string_free(result, true);
}
开发者ID:fletcher,项目名称:c-template,代码行数:17,代码来源:d_string.c

示例15: test_uri_normalize_2

test_uri_normalize_2(CuTest *tc)
{
	char *expect = strdup("http://www.example.com/test/func.cgi?x=y&z=j");
	uriobj_t uri;
	uri_parse(&uri, re, expect);
	int err = uri_normalize(&uri);
	CuAssertStrEquals(tc,*uri.uri_host,"www.example.com");
}
开发者ID:azzmosphere,项目名称:Azzmos-0.1.1,代码行数:8,代码来源:test_uriobj.c


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