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

C++ ensure_equals函数代码示例

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

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



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

示例1: p

void testObj::test<7>(void)
{
  const Strategy::Params p(123, -0.11);
  ensure_equals("invalid timeout", p.timeout_,   123);
  ensure_equals("invalid delta",   p.priDelta_, -0.11);
}
开发者ID:el-bart,项目名称:ACARM-ng,代码行数:6,代码来源:Strategy.t.cpp


示例2: ensure_equals

		~SDAllocationCheck()
		{
			ensure_equals(mMessage + " SDAllocationCheck",
				LLSD::allocationCount() - mAllocationAtStart,
				mExpectedAllocations);
		}
开发者ID:Nora28,项目名称:imprudence,代码行数:6,代码来源:llsd_new_tut.cpp


示例3: ensure_equals

void testObj::test<1>(void)
{
  ensure_equals("invalid READ value", Mode::READ, 1);
}
开发者ID:el-bart,项目名称:ACARM-ng,代码行数:4,代码来源:Mode.t.cpp


示例4: date

	void date_test_object_t::test<1>()
	{
		LLDate date(VALID_DATE);
		std::string  expected_string;
		bool result;
		expected_string = VALID_DATE;
		ensure_equals("Valid Date failed" , expected_string, date.asString());

		result = date.fromString(VALID_DATE_LEAP);
		expected_string = VALID_DATE_LEAP; 	
		ensure_equals("VALID_DATE_LEAP failed" , expected_string, date.asString());

		result = date.fromString(VALID_DATE_HOUR_BOUNDARY);
		expected_string = VALID_DATE_HOUR_BOUNDARY; 	
		ensure_equals("VALID_DATE_HOUR_BOUNDARY failed" , expected_string, date.asString());

		result = date.fromString(VALID_DATE_FRACTIONAL_SECS);
		expected_string = VALID_DATE_FRACTIONAL_SECS;
		ensure_equals("VALID_DATE_FRACTIONAL_SECS failed" , expected_string, date.asString());

		result = date.fromString(INVALID_DATE_MISSING_YEAR);
		ensure_equals("INVALID_DATE_MISSING_YEAR should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MISSING_MONTH);
		ensure_equals("INVALID_DATE_MISSING_MONTH should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MISSING_DATE);
		ensure_equals("INVALID_DATE_MISSING_DATE should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MISSING_T);
		ensure_equals("INVALID_DATE_MISSING_T should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MISSING_HOUR);
		ensure_equals("INVALID_DATE_MISSING_HOUR should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MISSING_MIN);
		ensure_equals("INVALID_DATE_MISSING_MIN should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MISSING_SEC);
		ensure_equals("INVALID_DATE_MISSING_SEC should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MISSING_Z);
		ensure_equals("INVALID_DATE_MISSING_Z should have failed" , result, false);

		result = date.fromString(INVALID_DATE_EMPTY);
		ensure_equals("INVALID_DATE_EMPTY should have failed" , result, false);
	}
开发者ID:AlchemyDev,项目名称:Carbon,代码行数:47,代码来源:lldate_test.cpp


示例5: ensure_equals

void testObj::test<5>(void)
{
  ensure_equals("invalid concatenataion",
                ce_.cc("a", "b", "c", "d", "e", "f"), "abcdef");
}
开发者ID:el-bart,项目名称:ACARM-ng,代码行数:5,代码来源:CommonElements.t.cpp


示例6: u

void URITestObject::test<18>()
{
    LLURI u("GIS:///app/login?first_name=Testert4&last_name=Tester&web_login_key=test");
    // if GIS is the scheme, LLURI should parse /app/login as path, with no authority
    ensure_equals("scheme",		u.scheme(),		"GIS");
    ensure_equals("authority",	u.authority(),	"");
    ensure_equals("path",		u.path(),		"/app/login");
    ensure_equals("pathmap",	u.pathArray()[0].asString(),	"app");
    ensure_equals("pathmap",	u.pathArray()[1].asString(),	"login");
    ensure_equals("query",		u.query(),		"first_name=Testert4&last_name=Tester&web_login_key=test");
    ensure_equals("query map element", u.queryMap()["last_name"].asString(), "Tester");

    u = LLURI("GIS://Da Boom/128/128/128");
    // if GIS is the scheme, LLURI should parse /128/128/128 as path, with Da Boom as authority
    ensure_equals("scheme",		u.scheme(),		"GIS");
    ensure_equals("authority",	u.authority(),	"Da Boom");
    ensure_equals("path",		u.path(),		"/128/128/128");
    ensure_equals("pathmap",	u.pathArray()[0].asString(),	"128");
    ensure_equals("pathmap",	u.pathArray()[1].asString(),	"128");
    ensure_equals("pathmap",	u.pathArray()[2].asString(),	"128");
    ensure_equals("query",		u.query(),		"");
}
开发者ID:HizWylder,项目名称:GIS,代码行数:22,代码来源:lluri_test.cpp


示例7: set_test_name

    void testobject::test<2>()
    {
        set_test_name("Check traff types");

        TARIFF_DATA td("test");
        td.tariffConf.fee = 1;
        td.tariffConf.free = 2;
        td.tariffConf.traffType = TARIFF::TRAFF_UP;
        td.tariffConf.passiveCost = 4;
        td.dirPrice[0].mDay = 30;
        td.dirPrice[0].hDay = 9;
        td.dirPrice[0].mNight = 30;
        td.dirPrice[0].hNight = 21;
        td.dirPrice[0].priceDayA = 0;
        td.dirPrice[0].priceDayB = 1;
        td.dirPrice[0].priceNightA = 2;
        td.dirPrice[0].priceNightB = 3;
        td.dirPrice[0].threshold = 4;
        td.dirPrice[0].singlePrice = 0;
        td.dirPrice[0].noDiscount = 0;
        TARIFF_IMPL tariff(td);

        ensure("traffType = TRAFF_UP", tariff.GetTraffType() == TARIFF::TRAFF_UP);
        ensure_equals("traffByType(6, 0) = 6 for UP", tariff.GetTraffByType(6, 0), 6);
        ensure_equals("traffByType(5, 1) = 5 for UP", tariff.GetTraffByType(5, 1), 5);
        ensure_equals("traffByType(4, 2) = 4 for UP", tariff.GetTraffByType(4, 2), 4);
        ensure_equals("traffByType(3, 3) = 3 for UP", tariff.GetTraffByType(3, 3), 3);
        ensure_equals("traffByType(2, 4) = 2 for UP", tariff.GetTraffByType(2, 4), 2);
        ensure_equals("traffByType(1, 5) = 1 for UP", tariff.GetTraffByType(1, 5), 1);
        ensure_equals("traffByType(0, 6) = 0 for UP", tariff.GetTraffByType(0, 6), 0);

        td.tariffConf.traffType = TARIFF::TRAFF_DOWN;
        tariff = td;

        ensure("traffType = TRAFF_DOWN", tariff.GetTraffType() == TARIFF::TRAFF_DOWN);
        ensure_equals("traffByType(6, 0) = 0 for DOWN", tariff.GetTraffByType(6, 0), 0);
        ensure_equals("traffByType(5, 1) = 1 for DOWN", tariff.GetTraffByType(5, 1), 1);
        ensure_equals("traffByType(4, 2) = 2 for DOWN", tariff.GetTraffByType(4, 2), 2);
        ensure_equals("traffByType(3, 3) = 3 for DOWN", tariff.GetTraffByType(3, 3), 3);
        ensure_equals("traffByType(2, 4) = 4 for DOWN", tariff.GetTraffByType(2, 4), 4);
        ensure_equals("traffByType(1, 5) = 5 for DOWN", tariff.GetTraffByType(1, 5), 5);
        ensure_equals("traffByType(0, 6) = 6 for DOWN", tariff.GetTraffByType(0, 6), 6);

        td.tariffConf.traffType = TARIFF::TRAFF_MAX;
        tariff = td;

        ensure("traffType = TRAFF_MAX", tariff.GetTraffType() == TARIFF::TRAFF_MAX);
        ensure_equals("traffByType(6, 0) = 6 for MAX", tariff.GetTraffByType(6, 0), 6);
        ensure_equals("traffByType(5, 1) = 5 for MAX", tariff.GetTraffByType(5, 1), 5);
        ensure_equals("traffByType(4, 2) = 4 for MAX", tariff.GetTraffByType(4, 2), 4);
        ensure_equals("traffByType(3, 3) = 3 for MAX", tariff.GetTraffByType(3, 3), 3);
        ensure_equals("traffByType(2, 4) = 4 for MAX", tariff.GetTraffByType(2, 4), 4);
        ensure_equals("traffByType(1, 5) = 5 for MAX", tariff.GetTraffByType(1, 5), 5);
        ensure_equals("traffByType(0, 6) = 6 for MAX", tariff.GetTraffByType(0, 6), 6);

        td.tariffConf.traffType = TARIFF::TRAFF_UP_DOWN;
        tariff = td;

        ensure("traffType = TRAFF_UP_DOWN", tariff.GetTraffType() == TARIFF::TRAFF_UP_DOWN);
        ensure_equals("traffByType(6, 0) = 6 for UP_DOWN", tariff.GetTraffByType(6, 0), 6);
        ensure_equals("traffByType(5, 1) = 6 for UP_DOWN", tariff.GetTraffByType(5, 1), 6);
        ensure_equals("traffByType(4, 2) = 6 for UP_DOWN", tariff.GetTraffByType(4, 2), 6);
        ensure_equals("traffByType(3, 3) = 6 for UP_DOWN", tariff.GetTraffByType(3, 3), 6);
        ensure_equals("traffByType(2, 4) = 6 for UP_DOWN", tariff.GetTraffByType(2, 4), 6);
        ensure_equals("traffByType(1, 5) = 6 for UP_DOWN", tariff.GetTraffByType(1, 5), 6);
        ensure_equals("traffByType(0, 6) = 6 for UP_DOWN", tariff.GetTraffByType(0, 6), 6);
    }
开发者ID:madf,项目名称:stg,代码行数:67,代码来源:test_tariff.cpp


示例8: ensure_equals

	void sd_object::test<16>()
	{
		std::string val = "[f,t,0,1,{'foo':t,'bar':f}]";
		std::istringstream istr;
		istr.str(val);
		LLSD sd;
		LLSDSerialize::fromNotation(sd, istr, val.size());
		ensure_equals("parsed type", sd.type(), LLSD::TypeArray);
		ensure_equals("parsed size", sd.size(), 5);
		ensure_equals("element 0 false", sd[0].asBoolean(), false);
		ensure_equals("element 1 true", sd[1].asBoolean(), true);
		ensure_equals("element 2 false", sd[2].asBoolean(), false);
		ensure_equals("element 3 true", sd[3].asBoolean(), true);
		LLSD map = sd[4];
		ensure_equals("element 4 type", map.type(), LLSD::TypeMap);
		ensure_equals("map foo type", map["foo"].type(), LLSD::TypeBoolean);
		ensure_equals("map foo value", map["foo"].asBoolean(), true);
		ensure_equals("map bar type", map["bar"].type(), LLSD::TypeBoolean);
		ensure_equals("map bar value", map["bar"].asBoolean(), false);
	}
开发者ID:AlericInglewood,项目名称:SingularityViewer,代码行数:20,代码来源:common.cpp


示例9: sizeof

	void datapacker_test_object_t::test<2>()
	{
		U8 packbuf[1024];

		char str[] = "SecondLife is virtual World\0";
		char strBinary[] = "SecondLife is virtual World";
		char strBinaryFixed[] = "Fixed Data";
		S32 sizeBinaryFixed = sizeof(strBinaryFixed);
		U8 valU8 = 'C';
		U16 valU16 = 0xFFFF;
		U32 valU32 = 0xFFFFFFFF;
		S32 valS32 = -94967295;
		F32 valF32 = 4354355.44f ;
		LLColor4 llcol4(3.3f, 0, 4.4f, 5.5f);
		LLColor4U llcol4u(3, 128, 24, 33);
		LLVector2 llvec2(333.33f, 444.44f);
		LLVector3 llvec3(333.33f, 444.44f, 555.55f);
		LLVector4 llvec4(333.33f, 444.44f, 555.55f, 666.66f);
		LLUUID uuid;

		std::string unpkstr;
		char unpkstrBinary[256];
		char unpkstrBinaryFixed[256];
		S32 unpksizeBinary;
		U8 unpkvalU8;
		U16 unpkvalU16;
		U32 unpkvalU32;
		S32 unpkvalS32;
		F32 unpkvalF32;
		LLColor4 unpkllcol4;
		LLColor4U unpkllcol4u;
		LLVector2 unpkllvec2;
		LLVector3 unpkllvec3;
		LLVector4 unpkllvec4;
		LLUUID unpkuuid;

		LLDataPackerBinaryBuffer lldp(packbuf,1024);
		lldp.packString(str , "linden_lab_str");
		lldp.packBinaryData((U8*)strBinary, sizeof(strBinary), "linden_lab_bd");
		lldp.packBinaryDataFixed((U8*)strBinaryFixed, sizeBinaryFixed, "linden_lab_bdf");
		lldp.packU8(valU8,"linden_lab_u8");
		lldp.packU16(valU16,"linden_lab_u16");
		lldp.packU32(valU32, "linden_lab_u32");
		lldp.packS32(valS32, "linden_lab_s32");
		lldp.packF32(valF32, "linden_lab_f32");
		lldp.packColor4(llcol4, "linden_lab_col4");
		lldp.packColor4U(llcol4u, "linden_lab_col4u");
		lldp.packVector2(llvec2, "linden_lab_vec2");
		lldp.packVector3(llvec3, "linden_lab_vec3");
		lldp.packVector4(llvec4, "linden_lab_vec4");
		uuid.generate();
		lldp.packUUID(uuid, "linden_lab_uuid");

		S32 cur_size = lldp.getCurrentSize();

		LLDataPackerBinaryBuffer lldp1(packbuf, cur_size);
		lldp1.unpackString(unpkstr , "linden_lab_str");
		lldp1.unpackBinaryData((U8*)unpkstrBinary, unpksizeBinary, "linden_lab_bd");
		lldp1.unpackBinaryDataFixed((U8*)unpkstrBinaryFixed, sizeBinaryFixed, "linden_lab_bdf");
		lldp1.unpackU8(unpkvalU8,"linden_lab_u8");
		lldp1.unpackU16(unpkvalU16,"linden_lab_u16");
		lldp1.unpackU32(unpkvalU32, "linden_lab_u32");
		lldp1.unpackS32(unpkvalS32, "linden_lab_s32");
		lldp1.unpackF32(unpkvalF32, "linden_lab_f32");
		lldp1.unpackColor4(unpkllcol4, "linden_lab_col4");
		lldp1.unpackColor4U(unpkllcol4u, "linden_lab_col4u");
		lldp1.unpackVector2(unpkllvec2, "linden_lab_vec2");
		lldp1.unpackVector3(unpkllvec3, "linden_lab_vec3");
		lldp1.unpackVector4(unpkllvec4, "linden_lab_vec4");
		lldp1.unpackUUID(unpkuuid, "linden_lab_uuid");

		ensure("LLDataPackerBinaryBuffer::packString failed", strcmp(str, unpkstr.c_str())  == 0);
		ensure("LLDataPackerBinaryBuffer::packBinaryData failed", strcmp(strBinary, unpkstrBinary)  == 0);
		ensure("LLDataPackerBinaryBuffer::packBinaryDataFixed failed", strcmp(strBinaryFixed, unpkstrBinaryFixed) == 0);
		ensure_equals("LLDataPackerBinaryBuffer::packU8 failed", valU8, unpkvalU8);
		ensure_equals("LLDataPackerBinaryBuffer::packU16 failed", valU16, unpkvalU16);
		ensure_equals("LLDataPackerBinaryBuffer::packU32 failed", valU32, unpkvalU32);
		ensure_equals("LLDataPackerBinaryBuffer::packS32 failed", valS32, unpkvalS32);
		ensure("LLDataPackerBinaryBuffer::packF32 failed", is_approx_equal(valF32, unpkvalF32));
		ensure_equals("LLDataPackerBinaryBuffer::packColor4 failed", llcol4, unpkllcol4);
		ensure_equals("LLDataPackerBinaryBuffer::packColor4U failed", llcol4u, unpkllcol4u);
		ensure_equals("LLDataPackerBinaryBuffer::packVector2 failed", llvec2, unpkllvec2);
		ensure_equals("LLDataPackerBinaryBuffer::packVector3 failed", llvec3, unpkllvec3);
		ensure_equals("LLDataPackerBinaryBuffer::packVector4 failed", llvec4, unpkllvec4);
		ensure_equals("LLDataPackerBinaryBuffer::packUUID failed", uuid, unpkuuid);
	}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:86,代码来源:lldatapacker_tut.cpp


示例10: it

void testObj::test<13>(void)
{
  Iter      it(data2_);
  ConstIter cit(it);
  ensure_equals("iterators point ot different places", *it, *cit);
}
开发者ID:el-bart,项目名称:ACARM-ng,代码行数:6,代码来源:GrowingVectorIterator.t.cpp


示例11: ensure_equals

void testObj::test<6>(void)
{
  ensure_equals("pre-condition failed", params_.heartbeats_, 0);
  impl_.heartbeat(42u);
  ensure_equals("call not passed", params_.heartbeats_, 1);
}
开发者ID:el-bart,项目名称:ACARM-ng,代码行数:6,代码来源:InterfaceImpl.t.cpp


示例12: ensure_equals

void testObj::test<2>(void)
{
  ensure_equals("mutex not locked", pthread_mutex_trylock(&g_testMutex), EBUSY);
}
开发者ID:el-bart,项目名称:ACARM-ng,代码行数:4,代码来源:SafeInitLocking.t.cpp


示例13: ensure_equals

    void deps_object::test<1>()
    {
        StringDeps deps;
        StringList empty;
        // The quick brown fox jumps over the lazy yellow dog.
        // (note, "The" and "the" are distinct, else this test wouldn't work)
        deps.add("lazy");
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")));
        deps.add("jumps");
        ensure("found lazy", deps.get("lazy"));
        ensure("not found dog.", ! deps.get("dog."));
        // NOTE: Maybe it's overkill to test each of these intermediate
        // results before all the interdependencies have been specified. My
        // thought is simply that if the order changes, I'd like to know why.
        // A change to the implementation of boost::topological_sort() would
        // be an acceptable reason, and you can simply update the expected
        // test output.
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps")));
        deps.add("The", 0, empty, list_of("fox")("dog."));
        // Test key accessors
        ensure("empty before deps for missing key", is_empty(deps.get_before_range("bogus")));
        ensure("empty before deps for jumps", is_empty(deps.get_before_range("jumps")));
        ensure_equals(instance_from_range< std::set<std::string> >(deps.get_before_range("The")),
                      make< std::set<std::string> >(list_of("dog.")("fox")));
        // resume building dependencies
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps")("The")));
        deps.add("the", 0, list_of("The"));
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("jumps")("The")("the")));
        deps.add("fox", 0, list_of("The"), list_of("jumps"));
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")));
        deps.add("the", 0, list_of("The")); // same, see if cache works
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")));
        deps.add("jumps", 0, empty, list_of("over")); // update jumps deps
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")));
/*==========================================================================*|
        // It drives me nuts that this test doesn't work in the test
        // framework, because -- for reasons unknown -- running the test
        // framework on Mac OS X 10.5 Leopard and Windows XP Pro, the catch
        // clause below doesn't catch the exception. Something about the TUT
        // test framework?!? The identical code works fine in a standalone
        // test program. Commenting out the test for now, in hopes that our
        // real builds will be able to catch Cycle exceptions...
        try
        {
            // We've already specified fox -> jumps and jumps -> over. Try an
            // impossible constraint.
            deps.add("over", 0, empty, list_of("fox"));
        }
        catch (const StringDeps::Cycle& e)
        {
            std::cout << "Cycle detected: " << e.what() << '\n';
            // It's legal to add() an impossible constraint because we don't
            // detect the cycle until sort(). So sort() can't know the minimum set
            // of nodes to remove to make the StringDeps object valid again.
            // Therefore we must break the cycle by hand.
            deps.remove("over");
        }
|*==========================================================================*/
        deps.add("dog.", 0, list_of("yellow")("lazy"));
        ensure_equals(instance_from_range< std::set<std::string> >(deps.get_after_range("dog.")),
                      make< std::set<std::string> >(list_of("lazy")("yellow")));
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("fox")("jumps")("dog.")));
        deps.add("quick", 0, list_of("The"), list_of("fox")("brown"));
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("the")("quick")("fox")("jumps")("dog.")));
        deps.add("over", 0, list_of("jumps"), list_of("yellow")("the"));
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("lazy")("The")("quick")("fox")("jumps")("over")("the")("dog.")));
        deps.add("yellow", 0, list_of("the"), list_of("lazy"));
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("The")("quick")("fox")("jumps")("over")("the")("yellow")("lazy")("dog.")));
        deps.add("brown");
        // By now the dependencies are pretty well in place. A change to THIS
        // order should be viewed with suspicion.
        ensure_equals(sorted_keys(deps), make<StringList>(list_of("The")("quick")("brown")("fox")("jumps")("over")("the")("yellow")("lazy")("dog.")));

        StringList keys(make<StringList>(list_of("The")("brown")("dog.")("fox")("jumps")("lazy")("over")("quick")("the")("yellow")));
        ensure_equals(instance_from_range<StringList>(deps.get_key_range()), keys);
#if (! defined(__GNUC__)) || (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
        // This is the succinct way, works on modern compilers
        ensure_equals(instance_from_range<StringList>(make_transform_range(deps.get_range(), extract_key)), keys);
#else   // gcc 3.3
        StringDeps::range got_range(deps.get_range());
        StringDeps::iterator kni = got_range.begin(), knend = got_range.end();
        StringList::iterator ki = keys.begin(), kend = keys.end();
        for ( ; kni != knend && ki != kend; ++kni, ++ki)
        {
            ensure_equals(kni->first, *ki);
        }
        ensure("get_range() returns proper length", kni == knend && ki == kend);
#endif  // gcc 3.3
        // blow off get_node_range() because they're all LLDependenciesEmpty instances
    }
开发者ID:Belxjander,项目名称:Kirito,代码行数:90,代码来源:lldependencies_test.cpp


示例14: ensure_equals

 void stringize_object::test<2>()
 {
     ensure_equals(STRINGIZE("c is " << c), "c is c");
     ensure_equals(STRINGIZE(std::setprecision(4) << d), "3.142");
 }
开发者ID:HizWylder,项目名称:GIS,代码行数:5,代码来源:stringize_test.cpp


示例15: const_nideps

    void deps_object::test<2>()
    {
        typedef LLDependencies<std::string, int> NameIndexDeps;
        NameIndexDeps nideps;
        const NameIndexDeps& const_nideps(nideps);
        nideps.add("def", 2, list_of("ghi"));
        nideps.add("ghi", 3);
        nideps.add("abc", 1, list_of("def"));
        NameIndexDeps::range range(nideps.get_range());
        ensure_equals(range.begin()->first, "abc");
        ensure_equals(range.begin()->second, 1);
        range.begin()->second = 0;
        range.begin()->second = 1;
        NameIndexDeps::const_range const_range(const_nideps.get_range());
        NameIndexDeps::const_iterator const_iterator(const_range.begin());
        ++const_iterator;
        ensure_equals(const_iterator->first, "def");
        ensure_equals(const_iterator->second, 2);
//        NameIndexDeps::node_range node_range(nideps.get_node_range());
//        ensure_equals(instance_from_range<std::vector<int> >(node_range), make< std::vector<int> >(list_of(1)(2)(3)));
//        *node_range.begin() = 0;
//        *node_range.begin() = 1;
        NameIndexDeps::const_node_range const_node_range(const_nideps.get_node_range());
        ensure_equals(instance_from_range<std::vector<int> >(const_node_range), make< std::vector<int> >(list_of(1)(2)(3)));
        NameIndexDeps::const_key_range const_key_range(const_nideps.get_key_range());
        ensure_equals(instance_from_range<StringList>(const_key_range), make<StringList>(list_of("abc")("def")("ghi")));
        NameIndexDeps::sorted_range sorted(const_nideps.sort());
        NameIndexDeps::sorted_iterator sortiter(sorted.begin());
        ensure_equals(sortiter->first, "ghi");
        ensure_equals(sortiter->second, 3);

        // test all iterator-flavored versions of get_after_range()
        StringList def(make<StringList>(list_of("def")));
        ensure("empty abc before list", is_empty(nideps.get_before_range(nideps.get_range().begin())));
        ensure_equals(instance_from_range<StringList>(nideps.get_after_range(nideps.get_range().begin())),
                      def);
        ensure_equals(instance_from_range<StringList>(const_nideps.get_after_range(const_nideps.get_range().begin())),
                      def);
//        ensure_equals(instance_from_range<StringList>(nideps.get_after_range(nideps.get_node_range().begin())),
//                      def);
        ensure_equals(instance_from_range<StringList>(const_nideps.get_after_range(const_nideps.get_node_range().begin())),
                      def);
        ensure_equals(instance_from_range<StringList>(nideps.get_after_range(nideps.get_key_range().begin())),
                      def);
        // advance from "ghi" to "def", which must come after "ghi"
        ++sortiter;
        ensure_equals(instance_from_range<StringList>(const_nideps.get_after_range(sortiter)),
                      make<StringList>(list_of("ghi")));
    }
开发者ID:Belxjander,项目名称:Kirito,代码行数:49,代码来源:lldependencies_test.cpp


示例16: date1

	void date_test_object_t::test<4>()
	{
		LLDate date1(VALID_DATE);
		LLDate date2(date1);
		ensure_equals("LLDate(const LLDate& date) constructor failed", date1.asString(), date2.asString());
	}
开发者ID:AlchemyDev,项目名称:Carbon,代码行数:6,代码来源:lldate_test.cpp


示例17: checkIsValid

	void checkIsValid(Geometry& geom, bool expected)
	{
		IsValidOp validator(&geom);
		bool isValid = validator.isValid();
		ensure_equals(isValid, expected);
	}
开发者ID:mwtoews,项目名称:libgeos,代码行数:6,代码来源:ValidClosedRingTest.cpp


示例18: v

	void SDTestObject::test<8>()
		// Test construction of various scalar types from LLSD.
		// Test both construction and initialization forms.
		// These should invoke the right conversion without it being
		// mentioned explicitly.  The few exceptions are marked SAD.
	{
		SDCleanupCheck check;
		
		LLSD v("  42.375");
		
		bool b1(v);		ensure_equals("contruct bool", b1, true);
		bool b2 = v;	ensure_equals("initialize bool", b2, true);
				
		int i1(v);		ensure_equals("contruct int", i1, 42);
		int i2 = v;		ensure_equals("initialize int", i2, 42);
		
		double d1(v);	ensure_equals("contruct double", d1, 42.375);
		double d2 = v;	ensure_equals("initialize double", d2, 42.375);
		
		std::string s1(v);
		std::string s2 = v;
						ensure_equals("contruct string", s1, "  42.375");
						ensure_equals("initialize string", s2, "  42.375");

		std::string t1(v);
		std::string t2 = v.asString();		// SAD
						ensure_equals("contruct std::string", t1, "  42.375");
						ensure_equals("initialize std::string", t2, "  42.375");

		std::string uuidStr = "b1e50c2b-b627-4d23-8a86-a65d97b6319b";
		v = uuidStr;
		LLUUID uuid1(v.asUUID());		// SAD
		LLUUID uuid2 = v;
				ensure_equals("contruct LLUUID", uuid1, LLUUID(uuidStr));
				ensure_equals("initialize LLUUID", uuid2, LLUUID(uuidStr));

		std::string dateStr = "2005-10-24T15:00:00Z";
		v = dateStr;
		LLDate date1(v.asDate());		// SAD
		LLDate date2 = v;
				ensure_equals("contruct LLDate", date1.asString(), dateStr);
				ensure_equals("initialize LLDate", date2.asString(), dateStr);
				
		std::string uriStr = "http://secondlife.com";
		v = uriStr;
		LLURI uri1(v.asURI());			// SAD
		LLURI uri2 = v;
				ensure_equals("contruct LLURI", uri1.asString(), uriStr);
				ensure_equals("initialize LLURI", uri2.asString(), uriStr);
	}
开发者ID:Nora28,项目名称:imprudence,代码行数:50,代码来源:llsd_new_tut.cpp


示例19: ensure_equals

void testObj::test<1>(void)
{
  env_.run("tmp=persistency.OptionalString(\"test string\")");
  ensure_equals("invalid value", env_.var<OptionalString>("tmp").get(), string("test string"));
}
开发者ID:el-bart,项目名称:ACARM-ng,代码行数:5,代码来源:exportOptionalString.t.cpp


示例20: checkExpected

 void checkExpected(Geometry* result, const Geometry* expected)
 {
   bool isEqual = result->equalsExact(expected, 1.0e-5);
   ensure_equals("Expect: "+writer.write(expected)+" Obtained: "+writer.write(result), isEqual, true);
 }
开发者ID:ryandavid,项目名称:rotobox,代码行数:5,代码来源:LengthIndexedLineTest.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ensure_eventmachine函数代码示例发布时间:2022-05-30
下一篇:
C++ ensureVisible函数代码示例发布时间: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