void m3math_test_object_t::test<5>()
	{
		LLMatrix3 llmat_obj1;
		LLMatrix3 llmat_obj2;		
		LLMatrix3 llmat_obj3;
		
		LLVector3 llvec1(1, 3, 5);
		LLVector3 llvec2(3, 6, 1);
		LLVector3 llvec3(4, 6, 9);

		LLVector3 llvec4(1, 1, 5);
		LLVector3 llvec5(3, 6, 8);
		LLVector3 llvec6(8, 6, 2);

		LLVector3 llvec7(0, 0, 0);
		LLVector3 llvec8(0, 0, 0);
		LLVector3 llvec9(0, 0, 0);
		
		llmat_obj1.setRows(llvec1, llvec2, llvec3);
		llmat_obj2.setRows(llvec4, llvec5, llvec6);
		llmat_obj3.setRows(llvec7, llvec8, llvec9);
		llmat_obj3 = llmat_obj1 * llmat_obj2;
		ensure("LLMatrix3::operator*(const LLMatrix3 &a, const LLMatrix3 &b) failed", 
						50 == llmat_obj3.mMatrix[0][0] &&
						49 == llmat_obj3.mMatrix[0][1] &&
						39 == llmat_obj3.mMatrix[0][2] &&
						29 == llmat_obj3.mMatrix[1][0] &&
						45 == llmat_obj3.mMatrix[1][1] &&
						65 == llmat_obj3.mMatrix[1][2] &&
						94 == llmat_obj3.mMatrix[2][0] &&
						94 == llmat_obj3.mMatrix[2][1] &&
						86 == llmat_obj3.mMatrix[2][2]);
	}
	void m3math_test_object_t::test<11>()
	{
		LLMatrix3 llmat_obj1;
		
		LLVector3 llvec1(1, 2, 3);
		LLVector3 llvec2(3, 2, 1);
		LLVector3 llvec3(2, 2, 2);
		llmat_obj1.setRows(llvec1, llvec2, llvec3);
		ensure("LLMatrix3::determinant failed ",  0.0f == llmat_obj1.determinant());
	}
	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);
	}
	void m3math_test_object_t::test<8>()
	{
		LLMatrix3 llmat_obj1;
		LLMatrix3 llmat_obj2;		
		
		LLVector3 llvec1(1, 3, 5);
		LLVector3 llvec2(3, 6, 1);
		LLVector3 llvec3(4, 6, 9);

		llmat_obj1.setRows(llvec1, llvec2, llvec3);
		llmat_obj2.setRows(llvec1, llvec2, llvec3);
		ensure("LLMatrix3::operator==(const LLMatrix3 &a, const LLMatrix3 &b) failed", llmat_obj1 == llmat_obj2);

		llmat_obj2.setRows(llvec2, llvec2, llvec3);
		ensure("LLMatrix3::operator!=(const LLMatrix3 &a, const LLMatrix3 &b) failed", llmat_obj1 != llmat_obj2);
	}
	void m3math_test_object_t::test<7>()
	{
		LLMatrix3 llmat_obj1;
		LLVector3d llvec3d1;		
		LLVector3d llvec3d2(0, 3, 4);

		LLVector3 llvec1(1, 3, 5);
		LLVector3 llvec2(3, 2, 1);
		LLVector3 llvec3(4, 6, 0);
		
		llmat_obj1.setRows(llvec1, llvec2, llvec3);
		llvec3d1 = llvec3d2 * llmat_obj1;

		LLVector3d expected_result(25, 30, 3);
		
		ensure("LLMatrix3::operator*(const LLVector3 &a, const LLMatrix3 &b) failed", llvec3d1 == expected_result);
	}
	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);
	}
	void m3math_test_object_t::test<6>()
	{
				
		LLMatrix3 llmat_obj1;
		
		LLVector3 llvec(1, 3, 5);
		LLVector3 res_vec(0, 0, 0);
		LLVector3 llvec1(1, 3, 5);
		LLVector3 llvec2(3, 6, 1);
		LLVector3 llvec3(4, 6, 9);
		
		llmat_obj1.setRows(llvec1, llvec2, llvec3);
		res_vec = llvec * llmat_obj1;

		LLVector3 expected_result(30, 51, 53);

		ensure("LLMatrix3::operator*(const LLVector3 &a, const LLMatrix3 &b) failed", res_vec == expected_result);
	}
	void m3math_test_object_t::test<10>()
	{
		LLMatrix3 llmat_obj;
	
		LLVector3 llvec1(1, 2, 3);
		LLVector3 llvec2(3, 2, 1);
		LLVector3 llvec3(2, 2, 2);

		llmat_obj.setRows(llvec1, llvec2, llvec3);
		llmat_obj.transpose();

		LLVector3 resllvec1(1, 3, 2);
		LLVector3 resllvec2(2, 2, 2);
		LLVector3 resllvec3(3, 1, 2);
		LLMatrix3 expectedllmat_obj;
		expectedllmat_obj.setRows(resllvec1, resllvec2, resllvec3);

		ensure("LLMatrix3::transpose failed ", llmat_obj == expectedllmat_obj);
	}
	void m3math_test_object_t::test<13>()
	{
		LLMatrix3 llmat_obj;

		LLVector3 llvec1(3, 2, 1);
		LLVector3 llvec2(6, 2, 1);
		LLVector3 llvec3(3, 6, 8);

		llmat_obj.setRows(llvec1, llvec2, llvec3);
		llmat_obj.adjointTranspose();
		
		ensure("LLMatrix3::adjointTranspose failed ", 10 == llmat_obj.mMatrix[0][0] &&
						-45 == llmat_obj.mMatrix[1][0] &&
						30 == llmat_obj.mMatrix[2][0] &&
						-10 == llmat_obj.mMatrix[0][1] &&
						21 == llmat_obj.mMatrix[1][1] &&
						-12 == llmat_obj.mMatrix[2][1] &&
						0  == llmat_obj.mMatrix[0][2] &&
						3 == llmat_obj.mMatrix[1][2] &&
						-6 == llmat_obj.mMatrix[2][2]);
	}
Exemple #10
0
	void m3math_test_object_t::test<12>()
	{
		LLMatrix3 llmat_obj;

		LLVector3 llvec1(1, 4, 3);
		LLVector3 llvec2(1, 2, 0);
		LLVector3 llvec3(2, 4, 2);

		llmat_obj.setRows(llvec1, llvec2, llvec3);
		llmat_obj.orthogonalize();

		ensure("LLMatrix3::orthogonalize failed ", is_approx_equal(0.19611613f, llmat_obj.mMatrix[0][0]) &&
							is_approx_equal(0.78446454f, llmat_obj.mMatrix[0][1]) &&
							is_approx_equal(0.58834839f, llmat_obj.mMatrix[0][2]) &&
							is_approx_equal(0.47628206f, llmat_obj.mMatrix[1][0]) &&
							is_approx_equal(0.44826555f, llmat_obj.mMatrix[1][1]) &&
							is_approx_equal(-0.75644791f, llmat_obj.mMatrix[1][2]) &&
							is_approx_equal(-0.85714287f, llmat_obj.mMatrix[2][0]) &&
							is_approx_equal(0.42857143f, llmat_obj.mMatrix[2][1]) &&
							is_approx_equal(-0.28571427f, llmat_obj.mMatrix[2][2]));
	}
Exemple #11
0
	void m3math_test_object_t::test<12>()
	{
		LLMatrix3 llmat_obj;

		LLVector3 llvec1(1, 0, 0);
		LLVector3 llvec2(1, 2, 0);
		LLVector3 llvec3(2, 4, 2);

		llmat_obj.setRows(llvec1, llvec2, llvec3);
		llmat_obj.orthogonalize();

		ensure("LLMatrix3::orthogonalize failed ",
		       is_approx_equal(1.0f, llmat_obj.mMatrix[0][0]) &&
		       is_approx_equal(0.0f, llmat_obj.mMatrix[0][1]) &&
		       is_approx_equal(0.0f, llmat_obj.mMatrix[0][2]) &&
		       is_approx_equal(0.0f, llmat_obj.mMatrix[1][0]) &&
		       is_approx_equal(1.0f, llmat_obj.mMatrix[1][1]) &&
		       is_approx_equal(0.0f, llmat_obj.mMatrix[1][2]) &&
		       is_approx_equal(0.0f, llmat_obj.mMatrix[2][0]) &&
		       is_approx_equal(0.0f, llmat_obj.mMatrix[2][1]) &&
		       is_approx_equal(1.0f, llmat_obj.mMatrix[2][2]));
	}
	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);
	}
	void datapacker_test_object_t::test<14>()
	{
		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(3333333.33f, 444.333344f);
		LLVector3 llvec3(3323233.33f, 444.4324f, 555.553232f);
		LLVector4 llvec4(333.33233f, 444.4323234f, 55323225.55f, 6323236.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;

		std::ostringstream ostr;
		LLDataPackerAsciiFile lldp(ostr,2);

		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");

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

		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("LLDataPackerAsciiFile::packString (iostring) failed", strcmp(str, unpkstr.c_str())  == 0);
		ensure("LLDataPackerAsciiFile::packBinaryData (iostring) failed", strcmp(strBinary, unpkstrBinary)  == 0);
		ensure("LLDataPackerAsciiFile::packBinaryDataFixed (iostring) failed", strcmp(strBinaryFixed, unpkstrBinaryFixed) == 0);
		ensure_equals("LLDataPackerAsciiFile::packU8 (iostring) failed", valU8, unpkvalU8);
		ensure_equals("LLDataPackerAsciiFile::packU16 (iostring) failed", valU16, unpkvalU16);
		ensure_equals("LLDataPackerAsciiFile::packU32 (iostring) failed", valU32, unpkvalU32);
		ensure_equals("LLDataPackerAsciiFile::packS32 (iostring) failed", valS32, unpkvalS32);
		ensure("LLDataPackerAsciiFile::packF32 (iostring) failed", is_approx_equal(valF32, unpkvalF32));
		ensure_equals("LLDataPackerAsciiFile::packColor4 (iostring) failed", llcol4, unpkllcol4);
		ensure_equals("LLDataPackerAsciiFile::packColor4U (iostring) failed", llcol4u, unpkllcol4u);
		ensure_equals("LLDataPackerAsciiFile::packVector2 (iostring) failed", llvec2, unpkllvec2);
		ensure_equals("LLDataPackerAsciiFile::packVector3 (iostring) failed", llvec3, unpkllvec3);
		ensure_equals("LLDataPackerAsciiFile::packVector4 (iostring) failed", llvec4, unpkllvec4);
		ensure_equals("LLDataPackerAsciiFile::packUUID (iostring) failed", uuid, unpkuuid);
	}
	void datapacker_test_object_t::test<12>()
	{
		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;

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

		LLDataPackerAsciiFile lldp(fp,2);

		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");

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

		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");

		fclose(fp);

		ensure("LLDataPackerAsciiFile::packString failed", strcmp(str, unpkstr.c_str())  == 0);
		ensure("LLDataPackerAsciiFile::packBinaryData failed", strcmp(strBinary, unpkstrBinary)  == 0);
		ensure("LLDataPackerAsciiFile::packBinaryDataFixed failed", strcmp(strBinaryFixed, unpkstrBinaryFixed) == 0);
		ensure_equals("LLDataPackerAsciiFile::packU8 failed", valU8, unpkvalU8);
		ensure_equals("LLDataPackerAsciiFile::packU16 failed", valU16, unpkvalU16);
		ensure_equals("LLDataPackerAsciiFile::packU32 failed", valU32, unpkvalU32);
		ensure_equals("LLDataPackerAsciiFile::packS32 failed", valS32, unpkvalS32);
		ensure("LLDataPackerAsciiFile::packF32 failed", is_approx_equal(valF32, unpkvalF32));
		ensure_equals("LLDataPackerAsciiFile::packColor4 failed", llcol4, unpkllcol4);
		ensure_equals("LLDataPackerAsciiFile::packColor4U failed", llcol4u, unpkllcol4u);
		ensure_equals("LLDataPackerAsciiFile::packVector2 failed", llvec2, unpkllvec2);
		ensure_equals("LLDataPackerAsciiFile::packVector3 failed", llvec3, unpkllvec3);
		ensure_equals("LLDataPackerAsciiFile::packVector4 failed", llvec4, unpkllvec4);
		ensure_equals("LLDataPackerAsciiFile::packUUID failed", uuid, unpkuuid);
	}