コード例 #1
0
	void stat_counter_index_object_t::test<15>()
	{
		LLSimpleStatMMM<> m1;
		LLSimpleStatMMM<> m2;

		m1.record(5.0);
		m1.record(7.0);
		m1.record(9.0);
		
		m2.merge(m1);

		ensure_equals("Count after merge (p1)", 3, m2.getCount());
		ensure_approximately_equals("Min after merge (p1)", F32(5.0), m2.getMin(), 22);
		ensure_approximately_equals("Max after merge (p1)", F32(9.0), m2.getMax(), 22);
		ensure_approximately_equals("Mean after merge (p1)", F32(7.000), m2.getMean(), 22);

		ensure_equals("Source count of merge is undamaged (p1)", 3, m1.getCount());
		ensure_approximately_equals("Source min of merge is undamaged (p1)", F32(5.0), m1.getMin(), 22);
		ensure_approximately_equals("Source max of merge is undamaged (p1)", F32(9.0), m1.getMax(), 22);
		ensure_approximately_equals("Source mean of merge is undamaged (p1)", F32(7.0), m1.getMean(), 22);

		m1.reset();
		m2.reset();
		
		m1.record(-22.0);
		m1.record(-1.0);
		
		m2.merge(m1);

		ensure_equals("Count after merge (p2)", 2, m2.getCount());
		ensure_approximately_equals("Min after merge (p2)", F32(-22.0), m2.getMin(), 22);
		ensure_approximately_equals("Max after merge (p2)", F32(-1.0), m2.getMax(), 22);
		ensure_approximately_equals("Mean after merge (p2)", F32(-11.5), m2.getMean(), 22);
	}
コード例 #2
0
ファイル: v3dmath_tut.cpp プロジェクト: 9skunks/imprudence
	void v3dmath_object::test<13>()
	{
		F64 x1 = 1., y1 = 2., z1 = -1.1,div = 4.2;
		F64 t = 1.f / div;
		LLVector3d vec3D(x1,y1,z1), vec3Da;
		vec3Da = vec3D/div;
		ensure_approximately_equals(
			"1a:operator/ failed",
			vec3Da.mdV[VX],
			x1*t,
			8);
		ensure_approximately_equals(
			"1b:operator/ failed",
			vec3Da.mdV[VY],
			y1*t,
			8);
		ensure_approximately_equals(
			"1c:operator/ failed",
			vec3Da.mdV[VZ],
			z1*t,
			8);
		x1 = 1.23, y1 = 4., z1 = -2.32;
		vec3D.clearVec();
		vec3Da.clearVec();
		vec3D.setVec(x1,y1,z1);
		vec3Da = vec3D/div;
		ensure_approximately_equals(
			"2a:operator/ failed",
			vec3Da.mdV[VX],
			x1*t,
			8);
		ensure_approximately_equals(
			"2b:operator/ failed",
			vec3Da.mdV[VY],
			y1*t,
			8);
		ensure_approximately_equals(
			"2c:operator/ failed",
			vec3Da.mdV[VZ],
			z1*t,
			8);
		vec3D /= div;
		ensure_approximately_equals(
			"3a:operator/= failed",
			vec3D.mdV[VX],
			x1*t,
			8);
		ensure_approximately_equals(
			"3b:operator/= failed",
			vec3D.mdV[VY],
			y1*t,
			8);
		ensure_approximately_equals(
			"3c:operator/= failed",
			vec3D.mdV[VZ],
			z1*t,
			8);
	}
コード例 #3
0
	void stat_counter_index_object_t::test<8>()
	{
		LLSimpleStatMMM<F64> m1;
		typedef LLSimpleStatMMM<F64>::Value lcl_float;
		lcl_float zero(0);

		// Freshly-constructed
		ensure("Constructed MMM<F64> has 0 count", (0 == m1.getCount()));
		ensure("Constructed MMM<F64> has 0 min", (zero == m1.getMin()));
		ensure("Constructed MMM<F64> has 0 max", (zero == m1.getMax()));
		ensure("Constructed MMM<F64> has 0 mean no div-by-zero", (zero == m1.getMean()));

		// Single insert
		m1.record(1.0);
		ensure("Single insert MMM<F64> has 1 count", (1 == m1.getCount()));
		ensure("Single insert MMM<F64> has 1.0 min", (1.0 == m1.getMin()));
		ensure("Single insert MMM<F64> has 1.0 max", (1.0 == m1.getMax()));
		ensure("Single insert MMM<F64> has 1.0 mean", (1.0 == m1.getMean()));
		
		// Second insert
		m1.record(3.0);
		ensure("2nd insert MMM<F64> has 2 count", (2 == m1.getCount()));
		ensure("2nd insert MMM<F64> has 1.0 min", (1.0 == m1.getMin()));
		ensure("2nd insert MMM<F64> has 3.0 max", (3.0 == m1.getMax()));
		ensure_approximately_equals("2nd insert MMM<F64> has 2.0 mean", m1.getMean(), lcl_float(2.0), 1);

		// Third insert
		m1.record(5.0);
		ensure("3rd insert MMM<F64> has 3 count", (3 == m1.getCount()));
		ensure("3rd insert MMM<F64> has 1.0 min", (1.0 == m1.getMin()));
		ensure("3rd insert MMM<F64> has 5.0 max", (5.0 == m1.getMax()));
		ensure_approximately_equals("3rd insert MMM<F64> has 3.0 mean", m1.getMean(), lcl_float(3.0), 1);

		// Fourth insert
		m1.record(1000000.0);
		ensure("4th insert MMM<F64> has 4 count", (4 == m1.getCount()));
		ensure("4th insert MMM<F64> has 1.0 min", (1.0 == m1.getMin()));
		ensure("4th insert MMM<F64> has 1000000.0 max", (1000000.0 == m1.getMax()));
		ensure_approximately_equals("4th insert MMM<F64> has 250002.0 mean", m1.getMean(), lcl_float(250002.0), 1);

		// Reset
		m1.reset();
		ensure("Reset MMM<F64> has 0 count", (0 == m1.getCount()));
		ensure("Reset MMM<F64> has 0 min", (zero == m1.getMin()));
		ensure("Reset MMM<F64> has 0 max", (zero == m1.getMax()));
		ensure("Reset MMM<F64> has 0 mean no div-by-zero", (zero == m1.getMean()));
	}
コード例 #4
0
ファイル: v4math_tut.cpp プロジェクト: AlexRa/Kirstens-clone
	void v4math_object::test<18>()
	{
		F32 x = 1.f, y = 2.f, z = -1.1f;
		F32 angle1, angle2;
		LLVector4 vec4(x,y,z), vec4a(x,y,z);
		angle1 = angle_between(vec4, vec4a);
		vec4.normVec();
		vec4a.normVec();
		angle2 = acos(vec4 * vec4a);
		ensure_approximately_equals("1:angle_between: Fail " ,angle1,angle2,8);
		F32 x1 = 21.f, y1 = 2.23f, z1 = -1.1f;
		LLVector4 vec4b(x,y,z), vec4c(x1,y1,z1);
		angle1 = angle_between(vec4b, vec4c);
		vec4b.normVec();
		vec4c.normVec();
		angle2 = acos(vec4b * vec4c);
		ensure_approximately_equals("2:angle_between: Fail " ,angle1,angle2,8);
	}
コード例 #5
0
	void datapacker_test_object_t::test<1>()
	{
		U8 packbuf[128];
		F32 f_val1 = 44.44f, f_unpkval1;
		F32 f_val2 = 12344.443232f, f_unpkval2;
		F32 f_val3 = 44.4456789f, f_unpkval3;
		LLDataPackerBinaryBuffer lldp(packbuf,128);
		lldp.packFixed( f_val1, "linden_lab", FALSE, 8, 8);
		lldp.packFixed( f_val2, "linden_lab", FALSE, 14, 16);
		lldp.packFixed( f_val3, "linden_lab", FALSE, 8, 23);

		LLDataPackerBinaryBuffer lldp1(packbuf, lldp.getCurrentSize());
		lldp1.unpackFixed(f_unpkval1, "linden_lab", FALSE, 8, 8);
		lldp1.unpackFixed(f_unpkval2, "linden_lab", FALSE, 14, 16);
		lldp1.unpackFixed(f_unpkval3, "linden_lab", FALSE, 8, 23);
		ensure_approximately_equals("LLDataPackerBinaryBuffer::packFixed 8 failed", f_val1, f_unpkval1, 8);
		ensure_approximately_equals("LLDataPackerBinaryBuffer::packFixed 16 failed", f_val2, f_unpkval2, 16);
		ensure_approximately_equals("LLDataPackerBinaryBuffer::packFixed 23 failed", f_val3, f_unpkval3, 31);
	}
コード例 #6
0
	void datapacker_test_object_t::test<7>()
	{
		char packbuf[128];
		F32 f_val = 44.44f, f_unpkval;
		LLDataPackerAsciiBuffer lldp(packbuf,128);
		lldp.packFixed( f_val, "linden_lab", FALSE, 8, 8);

		LLDataPackerAsciiBuffer lldp1(packbuf, lldp.getCurrentSize());
		lldp1.unpackFixed(f_unpkval, "linden_lab", FALSE, 8, 8);
		ensure_approximately_equals("LLDataPackerAsciiBuffer::packFixed failed", f_val, f_unpkval, 8);
	}
コード例 #7
0
	void datapacker_test_object_t::test<13>()
	{
		F32 f_val = 44.44f, f_unpkval;

		std::ostringstream ostr;
		LLDataPackerAsciiFile lldp(ostr,2);
		lldp.packFixed( f_val, "linden_lab", FALSE, 8, 8);

		std::istringstream istr(ostr.str());
		LLDataPackerAsciiFile lldp1(istr,2);

		lldp1.unpackFixed(f_unpkval, "linden_lab", FALSE, 8, 8);

		ensure_approximately_equals("LLDataPackerAsciiFile::packFixed (iostring) failed", f_val, f_unpkval, 8);
	}
コード例 #8
0
	void stat_counter_index_object_t::test<16>()
	{
		LLSimpleStatMMM<> m1;
		LLSimpleStatMMM<> m2;

		m2.merge(m1);

		ensure_equals("Count after merge (p1)", 0, m2.getCount());
		ensure_approximately_equals("Min after merge (p1)", F32(0), m2.getMin(), 22);
		ensure_approximately_equals("Max after merge (p1)", F32(0), m2.getMax(), 22);
		ensure_approximately_equals("Mean after merge (p1)", F32(0), m2.getMean(), 22);

		ensure_equals("Source count of merge is undamaged (p1)", 0, m1.getCount());
		ensure_approximately_equals("Source min of merge is undamaged (p1)", F32(0), m1.getMin(), 22);
		ensure_approximately_equals("Source max of merge is undamaged (p1)", F32(0), m1.getMax(), 22);
		ensure_approximately_equals("Source mean of merge is undamaged (p1)", F32(0), m1.getMean(), 22);
	}
コード例 #9
0
	void datapacker_test_object_t::test<11>()
	{
		F32 f_val = 44.44f, f_unpkval;

		LLFILE* fp = LLFile::fopen(TEST_FILE_NAME, "w+");
		if(!fp)
		{
			LL_ERRS() << "File couldnt be open" <<LL_ENDL;
			return;
		}

		LLDataPackerAsciiFile lldp(fp,2);
		lldp.packFixed( f_val, "linden_lab", FALSE, 8, 8);

		fflush(fp);	
		fseek(fp,0,SEEK_SET);
		LLDataPackerAsciiFile lldp1(fp,2);

		lldp1.unpackFixed(f_unpkval, "linden_lab", FALSE, 8, 8);
		fclose(fp);

		ensure_approximately_equals("LLDataPackerAsciiFile::packFixed failed", f_val, f_unpkval, 8);
	}
コード例 #10
0
ファイル: v3dmath_tut.cpp プロジェクト: 9skunks/imprudence
	void v3dmath_object::test<19>()
	{
		F64 x = 1., y = 2., z = -1.1;
		LLVector3d vec3D(x,y,z);
		F64 mag = vec3D.normVec();
		mag = 1.f/ mag;
		ensure_approximately_equals(
			"1a:normVec: Fail ",
			vec3D.mdV[VX],
			x * mag,
			8);
		ensure_approximately_equals(
			"1b:normVec: Fail ",
			vec3D.mdV[VY],
			y * mag,
			8);
		ensure_approximately_equals(
			"1c:normVec: Fail ",
			vec3D.mdV[VZ],
			z * mag,
			8);
		x = 0.000000001, y = 0.000000001, z = 0.000000001;
		vec3D.clearVec();
		vec3D.setVec(x,y,z);
		mag = vec3D.normVec();
		ensure_approximately_equals(
			"2a:normVec: Fail ",
			vec3D.mdV[VX],
			x * mag,
			8);
		ensure_approximately_equals(
			"2b:normVec: Fail ",
			vec3D.mdV[VY],
			y * mag,
			8);
		ensure_approximately_equals(
			"2c:normVec: Fail ",
			vec3D.mdV[VZ],
			z * mag,
			8);
	}
コード例 #11
0
ファイル: v3dmath_tut.cpp プロジェクト: 9skunks/imprudence
	void v3dmath_object::test<11>()
	{
		F64 x1 = 1., y1 = 2., z1 = -1.1;
		F64 x2 = 1.2, y2 = 2.5, z2 = 1.;
		LLVector3d vec3D(x1,y1,z1),vec3Da(x2,y2,z2);
		F64 res = vec3D * vec3Da;
		ensure_approximately_equals(
			"1:operator* failed",
			res,
			(x1*x2 + y1*y2 + z1*z2),
			8);
		vec3Da.clearVec();
		F64 mulVal = 4.2;
		vec3Da = vec3D * mulVal;
		ensure_approximately_equals(
			"2a:operator* failed",
			vec3Da.mdV[VX],
			x1*mulVal,
			8);
		ensure_approximately_equals(
			"2b:operator* failed",
			vec3Da.mdV[VY],
			y1*mulVal,
			8);
		ensure_approximately_equals(
			"2c:operator* failed",
			vec3Da.mdV[VZ],
			z1*mulVal,
			8);
		vec3Da.clearVec();
		vec3Da = mulVal * vec3D;
		ensure_approximately_equals(
			"3a:operator* failed",
			vec3Da.mdV[VX],
			x1*mulVal,
			8);
		ensure_approximately_equals(
			"3b:operator* failed",
			vec3Da.mdV[VY],
			y1*mulVal,
			8);
		ensure_approximately_equals(
			"3c:operator* failed",
			vec3Da.mdV[VZ],
			z1*mulVal,
			8);
		vec3D *= mulVal;
		ensure_approximately_equals(
			"4a:operator*= failed",
			vec3D.mdV[VX],
			x1*mulVal,
			8);
		ensure_approximately_equals(
			"4b:operator*= failed",
			vec3D.mdV[VY],
			y1*mulVal,
			8);
		ensure_approximately_equals(
			"4c:operator*= failed",
			vec3D.mdV[VZ],
			z1*mulVal,
			8);
	}
コード例 #12
0
ファイル: llpartdata_tut.cpp プロジェクト: 9skunks/imprudence
	void partdata_test_object_t::test<1>()
	{
		LLPartData llpdata,llpdata1;
		U8 pkbuf[128];

		llpdata.setFlags(LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK |
		LLPartData::LL_PART_BOUNCE_MASK | LLPartData::LL_PART_WIND_MASK | LLPartData::LL_PART_FOLLOW_SRC_MASK |
		LLPartData::LL_PART_FOLLOW_VELOCITY_MASK | LLPartData::LL_PART_TARGET_POS_MASK | LLPartData::LL_PART_TARGET_LINEAR_MASK |
		LLPartData::LL_PART_EMISSIVE_MASK | LLPartData::LL_PART_BEAM_MASK | LLPartData::LL_PART_DEAD_MASK);

		llpdata.setMaxAge(29.3f);

		LLVector3 llvec1(1.0f, .5f, .25f);
		llpdata.setStartColor(llvec1);
		llpdata.setStartAlpha(.7f);

		LLVector3 llvec2(.2f, .3f, 1.0f);
		llpdata.setEndColor(llvec2);
		llpdata.setEndAlpha(1.0f);

		llpdata.setStartScale(3.23f, 4.0f);
		llpdata.setEndScale(2.4678f, 1.0f);

		LLDataPackerBinaryBuffer dp((U8*)pkbuf, 128);
		llpdata.pack(dp);
		
		S32 cur_size = dp.getCurrentSize();
		
		LLDataPackerBinaryBuffer dp1((U8*)pkbuf, cur_size);
		llpdata1.unpack(dp1);

		ensure("1.mFlags values are different after unpacking", llpdata1.mFlags == llpdata.mFlags);
		ensure_approximately_equals("2.mMaxAge values are different after unpacking", llpdata1.mMaxAge, llpdata.mMaxAge, 8);

		ensure_approximately_equals("3.mStartColor[0] values are different after unpacking", llpdata1.mStartColor.mV[0], llpdata.mStartColor.mV[0], 8);
		ensure_approximately_equals("4.mStartColor[1] values are different after unpacking", llpdata1.mStartColor.mV[1], llpdata.mStartColor.mV[1], 8);
		ensure_approximately_equals("5.mStartColor[2] values are different after unpacking", llpdata1.mStartColor.mV[2], llpdata.mStartColor.mV[2], 8);
		ensure_approximately_equals("6.mStartColor[3] values are different after unpacking", llpdata1.mStartColor.mV[3], llpdata.mStartColor.mV[3], 8);

		ensure_approximately_equals("7.mEndColor[0] values are different after unpacking", llpdata1.mEndColor.mV[0], llpdata.mEndColor.mV[0], 8);
		ensure_approximately_equals("8.mEndColor[1] values are different after unpacking", llpdata1.mEndColor.mV[1], llpdata.mEndColor.mV[1], 8);
		ensure_approximately_equals("9.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[2], llpdata.mEndColor.mV[2], 8);
		ensure_approximately_equals("10.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[3], llpdata.mEndColor.mV[3], 8);

		ensure_approximately_equals("11.mStartScale[0] values are different after unpacking", llpdata1.mStartScale.mV[0], llpdata.mStartScale.mV[0], 5);
		ensure_approximately_equals("12.mStartScale[1] values are different after unpacking", llpdata1.mStartScale.mV[1], llpdata.mStartScale.mV[1], 5);

		ensure_approximately_equals("13.mEndScale[0] values are different after unpacking", llpdata1.mEndScale.mV[0], llpdata.mEndScale.mV[0], 5);
		ensure_approximately_equals("14.mEndScale[1] values are different after unpacking", llpdata1.mEndScale.mV[1], llpdata.mEndScale.mV[1], 5);
	}
コード例 #13
0
ファイル: llpartdata_tut.cpp プロジェクト: 9skunks/imprudence
	void partdata_test_object_t::test<3>()
	{
		LLPartSysData llpsysdata, llpsysdata1;
		U8 pkbuf[256];
		llpsysdata.setBurstSpeedMin(33.33f);
		ensure("1.mBurstSpeedMin coudnt be set", 33.33f == llpsysdata.mBurstSpeedMin);

		llpsysdata.setBurstSpeedMax(44.44f); 
		ensure("2.mBurstSpeedMax coudnt be set", 44.44f == llpsysdata.mBurstSpeedMax);

		llpsysdata.setBurstRadius(45.55f);
		ensure("3.mBurstRadius coudnt be set", 45.55f == llpsysdata.mBurstRadius);

		LLVector3 llvec(44.44f, 111.11f, -40.4f);
		llpsysdata.setPartAccel(llvec);

		llpsysdata.mCRC = 0xFFFFFFFF;
		llpsysdata.mFlags = 0x20;

		llpsysdata.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY;

		llpsysdata.mMaxAge = 99.99f;
		llpsysdata.mStartAge = 18.5f;
		llpsysdata.mInnerAngle = 4.234f;
		llpsysdata.mOuterAngle = 7.123f;
		llpsysdata.mBurstRate  = 245.53f;
		llpsysdata.mBurstPartCount = 0xFF;
		llpsysdata.mAngularVelocity = llvec;

		llpsysdata.mPartImageID.generate();
		llpsysdata.mTargetUUID.generate();
		
		LLDataPackerBinaryBuffer dp((U8*)pkbuf, 256);
		llpsysdata.pack(dp);
		S32 cur_size = dp.getCurrentSize();
		LLDataPackerBinaryBuffer dp1((U8*)pkbuf, cur_size);
		llpsysdata1.unpack(dp1);

		ensure("1.mCRC's not equal", llpsysdata.mCRC == llpsysdata1.mCRC);
		ensure("2.mFlags's not equal", llpsysdata.mFlags == llpsysdata1.mFlags);
		ensure("3.mPattern's not equal", llpsysdata.mPattern == llpsysdata1.mPattern);
		ensure_approximately_equals("4.mMaxAge's not equal", llpsysdata.mMaxAge , llpsysdata1.mMaxAge, 8);
		ensure_approximately_equals("5.mStartAge's not equal", llpsysdata.mStartAge, llpsysdata1.mStartAge, 8);
		ensure_approximately_equals("6.mOuterAngle's not equal", llpsysdata.mOuterAngle, llpsysdata1.mOuterAngle, 5);
		ensure_approximately_equals("7.mInnerAngles's not equal", llpsysdata.mInnerAngle, llpsysdata1.mInnerAngle, 5);
		ensure_approximately_equals("8.mBurstRate's not equal", llpsysdata.mBurstRate, llpsysdata1.mBurstRate, 8);
		ensure("9.mBurstPartCount's not equal", llpsysdata.mBurstPartCount == llpsysdata1.mBurstPartCount);

		ensure_approximately_equals("10.mBurstSpeedMin's not equal", llpsysdata.mBurstSpeedMin, llpsysdata1.mBurstSpeedMin, 8);
		ensure_approximately_equals("11.mBurstSpeedMax's not equal", llpsysdata.mBurstSpeedMax, llpsysdata1.mBurstSpeedMax, 8);

		ensure_approximately_equals("12.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[0], llpsysdata1.mAngularVelocity.mV[0], 7);
		ensure_approximately_equals("13.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[1], llpsysdata1.mAngularVelocity.mV[1], 7);
		ensure_approximately_equals("14.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[2], llpsysdata1.mAngularVelocity.mV[2], 7);
			
		ensure_approximately_equals("15.mPartAccel's not equal", llpsysdata.mPartAccel.mV[0], llpsysdata1.mPartAccel.mV[0], 7);
		ensure_approximately_equals("16.mPartAccel's not equal", llpsysdata.mPartAccel.mV[1], llpsysdata1.mPartAccel.mV[1], 7);
		ensure_approximately_equals("17.mPartAccel's not equal", llpsysdata.mPartAccel.mV[2], llpsysdata1.mPartAccel.mV[2], 7);

		ensure("18.mPartImageID's not equal", llpsysdata.mPartImageID == llpsysdata1.mPartImageID);
		ensure("19.mTargetUUID's not equal", llpsysdata.mTargetUUID == llpsysdata1.mTargetUUID);
		ensure_approximately_equals("20.mBurstRadius's not equal", llpsysdata.mBurstRadius, llpsysdata1.mBurstRadius, 8);
	}
コード例 #14
0
ファイル: llpartdata_tut.cpp プロジェクト: 9skunks/imprudence
	void partdata_test_object_t::test<2>()
	{
		LLPartData llpdata,llpdata1;

		llpdata.setFlags(LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK |
		LLPartData::LL_PART_BOUNCE_MASK | LLPartData::LL_PART_WIND_MASK | LLPartData::LL_PART_FOLLOW_SRC_MASK |
		LLPartData::LL_PART_FOLLOW_VELOCITY_MASK | LLPartData::LL_PART_TARGET_POS_MASK | LLPartData::LL_PART_TARGET_LINEAR_MASK |
		LLPartData::LL_PART_EMISSIVE_MASK | LLPartData::LL_PART_BEAM_MASK | LLPartData::LL_PART_DEAD_MASK);
		
		llpdata.setMaxAge(29.3f);

		LLVector3 llvec1(1.0f, .5f, .25f);
		llpdata.setStartColor(llvec1);
		llpdata.setStartAlpha(.7f);

		LLVector3 llvec2(.2f, .3f, 1.0f);
		llpdata.setEndColor(llvec2);
		llpdata.setEndAlpha(1.0f);

		llpdata.setStartScale(3.23f, 4.0f);
		llpdata.setEndScale(2.4678f, 1.0f);

		LLSD llsd = llpdata.asLLSD();

		llpdata1.fromLLSD(llsd);

		ensure("1.mFlags values are different after unpacking", llpdata1.mFlags == llpdata.mFlags);
		ensure_approximately_equals("2.mMaxAge values are different after unpacking", llpdata1.mMaxAge, llpdata.mMaxAge, 8);

		ensure_approximately_equals("3.mStartColor[0] values are different after unpacking", llpdata1.mStartColor.mV[0], llpdata.mStartColor.mV[0], 8);
		ensure_approximately_equals("4.mStartColor[1] values are different after unpacking", llpdata1.mStartColor.mV[1], llpdata.mStartColor.mV[1], 8);
		ensure_approximately_equals("5.mStartColor[2] values are different after unpacking", llpdata1.mStartColor.mV[2], llpdata.mStartColor.mV[2], 8);
		ensure_approximately_equals("6.mStartColor[3] values are different after unpacking", llpdata1.mStartColor.mV[3], llpdata.mStartColor.mV[3], 8);

		ensure_approximately_equals("7.mEndColor[0] values are different after unpacking", llpdata1.mEndColor.mV[0], llpdata.mEndColor.mV[0], 8);
		ensure_approximately_equals("8.mEndColor[1] values are different after unpacking", llpdata1.mEndColor.mV[1], llpdata.mEndColor.mV[1], 8);
		ensure_approximately_equals("9.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[2], llpdata.mEndColor.mV[2], 8);
		ensure_approximately_equals("10.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[3], llpdata.mEndColor.mV[3], 8);

		ensure_approximately_equals("11.mStartScale[0] values are different after unpacking", llpdata1.mStartScale.mV[0], llpdata.mStartScale.mV[0], 5);
		ensure_approximately_equals("12.mStartScale[1] values are different after unpacking", llpdata1.mStartScale.mV[1], llpdata.mStartScale.mV[1], 5);

		ensure_approximately_equals("13.mEndScale[0] values are different after unpacking", llpdata1.mEndScale.mV[0], llpdata.mEndScale.mV[0], 5);
		ensure_approximately_equals("14.mEndScale[1] values are different after unpacking", llpdata1.mEndScale.mV[1], llpdata.mEndScale.mV[1], 5);
	}
コード例 #15
0
ファイル: llpartdata_test.cpp プロジェクト: Belxjander/Kirito
	void partdata_test_object_t::test<1>()
	{
		LLPartSysData llpsysdata;
		LLDataPackerBinaryBuffer dp1(msg, sizeof(msg));

		ensure("LLPartSysData::unpack failed.", llpsysdata.unpack(dp1));

		
		//mCRC	1	unsigned int
		ensure("mCRC different after unpacking", llpsysdata.mCRC == (U32) 1);
		//mFlags	0	unsigned int
		ensure ("mFlags different after unpacking", llpsysdata.mFlags == (U32) 0);
		//mPattern	1 ''	unsigned char
		ensure ("mPattern different after unpacking", llpsysdata.mPattern == (U8) 1);
		//mInnerAngle	0.00000000	float
		ensure_approximately_equals("mInnerAngle different after unpacking", llpsysdata.mInnerAngle, 0.f, 8);
		//mOuterAngle	0.00000000	float
		ensure_approximately_equals("mOuterAngle different after unpacking", llpsysdata.mOuterAngle, 0.f, 8);
		//mAngularVelocity	0,0,0
		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[0], 0.f, 8);
		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[1], 0.f, 8);
		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[2], 0.f, 8);
		//mBurstRate	0.097656250	float
		ensure_approximately_equals("mBurstRate different after unpacking", llpsysdata.mBurstRate, 0.097656250f, 8);
		//mBurstPartCount	1 ''	unsigned char
		ensure("mBurstPartCount different after unpacking", llpsysdata.mBurstPartCount == (U8) 1);
		//mBurstRadius	0.00000000	float
		ensure_approximately_equals("mBurstRadius different after unpacking", llpsysdata.mBurstRadius, 0.f, 8);
		//mBurstSpeedMin	1.0000000	float
		ensure_approximately_equals("mBurstSpeedMin different after unpacking", llpsysdata.mBurstSpeedMin, 1.f, 8);
		//mBurstSpeedMax	1.0000000	float
		ensure_approximately_equals("mBurstSpeedMax different after unpacking", llpsysdata.mBurstSpeedMax, 1.f, 8);
		//mMaxAge	0.00000000	float
		ensure_approximately_equals("mMaxAge different after unpacking", llpsysdata.mMaxAge, 0.f, 8);
		//mStartAge	0.00000000	float
		ensure_approximately_equals("mStartAge different after unpacking", llpsysdata.mStartAge, 0.f, 8);
		//mPartAccel	<0,0,0>
		ensure_approximately_equals("mPartAccel.mV[0] different after unpacking", llpsysdata.mPartAccel.mV[0], 0.f, 7);
		ensure_approximately_equals("mPartAccel.mV[1] different after unpacking", llpsysdata.mPartAccel.mV[1], 0.f, 7);
		ensure_approximately_equals("mPartAccel.mV[2] different after unpacking", llpsysdata.mPartAccel.mV[2], 0.f, 7);

		//mPartData
		LLPartData& data = llpsysdata.mPartData;

		//mFlags	132354	unsigned int
		ensure ("mPartData.mFlags different after unpacking", data.mFlags == (U32) 132354);
		//mMaxAge	10.000000	float
		ensure_approximately_equals("mPartData.mMaxAge different after unpacking", data.mMaxAge, 10.f, 8); 
		//mStartColor	<1,1,1,1>
		ensure_approximately_equals("mPartData.mStartColor.mV[0] different after unpacking", data.mStartColor.mV[0], 1.f, 8);
		ensure_approximately_equals("mPartData.mStartColor.mV[1] different after unpacking", data.mStartColor.mV[1], 1.f, 8);
		ensure_approximately_equals("mPartData.mStartColor.mV[2] different after unpacking", data.mStartColor.mV[2], 1.f, 8);
		ensure_approximately_equals("mPartData.mStartColor.mV[3] different after unpacking", data.mStartColor.mV[3], 1.f, 8);
		//mEndColor	<1,1,0,0>
		ensure_approximately_equals("mPartData.mEndColor.mV[0] different after unpacking", data.mEndColor.mV[0], 1.f, 8);
		ensure_approximately_equals("mPartData.mEndColor.mV[1] different after unpacking", data.mEndColor.mV[1], 1.f, 8);
		ensure_approximately_equals("mPartData.mEndColor.mV[2] different after unpacking", data.mEndColor.mV[2], 0.f, 8);
		ensure_approximately_equals("mPartData.mEndColor.mV[3] different after unpacking", data.mEndColor.mV[3], 0.f, 8);
		//mStartScale	<1,1>
		ensure_approximately_equals("mPartData.mStartScale.mV[0] different after unpacking", data.mStartScale.mV[0], 1.f, 8);
		ensure_approximately_equals("mPartData.mStartScale.mV[1] different after unpacking", data.mStartScale.mV[1], 1.f, 8);
		//mEndScale	<0,0>
		ensure_approximately_equals("mPartData.mEndScale.mV[0] different after unpacking", data.mEndScale.mV[0], 0.f, 8);
		ensure_approximately_equals("mPartData.mEndScale.mV[1] different after unpacking", data.mEndScale.mV[1], 0.f, 8);
		//mPosOffset	<0,0,0>
		ensure_approximately_equals("mPartData.mPosOffset.mV[0] different after unpacking", data.mPosOffset.mV[0], 0.f, 8);
		ensure_approximately_equals("mPartData.mPosOffset.mV[1] different after unpacking", data.mPosOffset.mV[1], 0.f, 8);
		ensure_approximately_equals("mPartData.mPosOffset.mV[2] different after unpacking", data.mPosOffset.mV[2], 0.f, 8);
		//mParameter	0.00000000	float
		ensure_approximately_equals("mPartData.mParameter different after unpacking", data.mParameter, 0.f, 8);
		
		//mStartGlow	0.00000000	float
		ensure_approximately_equals("mPartData.mStartGlow different after unpacking", data.mStartGlow, 0.f, 8);
		//mEndGlow	0.00000000	float
		ensure_approximately_equals("mPartData.mEndGlow different after unpacking", data.mEndGlow, 0.f, 8);
		//mBlendFuncSource	2 ''	unsigned char
		ensure("mPartData.mBlendFuncSource different after unpacking", data.mBlendFuncSource == (U8) 2);
		//mBlendFuncDest	1 ''	unsigned char 
		ensure("mPartData.mBlendFuncDest different after unpacking", data.mBlendFuncDest == (U8) 1);
	}