Beispiel #1
0
	void namevalue_object_t::test<16>()
	{
		LLNameValue nValue1("SecondLife STRING RW DSV 44444");
		LLNameValue nValue2("SecondLife STRING RW SIM 33333");
		LLNameValue nValue3("SecondLife");
		nValue3 = nValue1 + nValue2;
		ensure("1:operator+ failed",(0==strcmp(nValue3.getString(),"4444433333")));
		
		LLNameValue nValue4("SecondLife F32 R DSV 44444");
		LLNameValue nValue5("SecondLife F32 RW SIM 33333");
		LLNameValue nValue6("SecondLife");
		nValue6 = nValue4 + nValue5;
		ensure_equals("2:operator+ failed",*nValue6.getF32(),77777.0);
		
		LLNameValue nValue7("SecondLife F32 R DSV 44444");
		LLNameValue nValue8("SecondLife S32 RW SIM 33333");
		LLNameValue nValue9("SecondLife F32");
		nValue9 = nValue7 + nValue8;
		ensure_equals("3:operator+ failed",*nValue9.getF32(),77777.0);
		
		LLNameValue nValue10("SecondLife VEC3 RW SIM <4, 4, 4>");
		LLNameValue nValue11("SecondLife VEC3 RW SV <3, 3, 3>");
		LLNameValue nValue12("SecondLife VEC3");
		nValue12 = nValue10 + nValue11;
		LLVector3 vec(7,7,7);
		ensure_equals("4:operator+ failed",*nValue12.getVec3(), vec);	
	}
Beispiel #2
0
	void namevalue_object_t::test<12>()
	{
		LLNameValue nValue("SecondLife F32 RW SIM -333.337600");	
		F32 val = nValue.magnitude();
		ensure_equals("F32 magnitude failed", val, 333.337600f);
	
		LLNameValue nValue1("SecondLife STRING RW SIM 3300");	
		val = nValue1.magnitude();
		ensure_equals("STRING magnitude failed",val,4.0f);
		
		LLNameValue nValue2("SecondLife S32 RW SIM -3300");	
		val = nValue2.magnitude();
		ensure_equals("S32 magnitude failed", val, 3300.);
		
		LLNameValue nValue3("SecondLife U32 RW SIM 3300");	
		val = nValue3.magnitude();
		ensure_equals("U32 magnitude failed", val, 3300.);
		
		LLNameValue nValue4("SecondLife VEC3 RW SIM <1,2,3>");	
		LLVector3 vec(1,2,3);
		val = nValue4.magnitude();
		ensure_equals("VEC3 magnitude failed", val, vec.magVec());
		
		skip_fail("incomplete support for U64.");
		LLNameValue nValue5("SecondLife U64 RW SIM 12345");	
		val = nValue5.magnitude();
		ensure_equals("U62 magnitude failed", val, 12345);		
	}
Beispiel #3
0
	void namevalue_object_t::test<3>()
	{
		LLNameValue nValue("SecondLife", "232324343", "ASSET", "READ_WRITE");
		ensure("mName not set correctly", (0 == strcmp(nValue.mName,"SecondLife")));
		ensure("getTypeEnum failed", nValue.getTypeEnum() == NVT_ASSET);
		ensure("getClassEnum failed", nValue.getClassEnum() == NVC_READ_WRITE);
		ensure("getSendtoEnum failed", nValue.getSendtoEnum() == NVS_SIM);
		ensure("getString failed", (0==strcmp(nValue.getAsset(),"232324343")));

		LLNameValue nValue1("SecondLife", "232324343", "STRING", "READ_WRITE");
		ensure("1. mName not set correctly", (0 == strcmp(nValue1.mName,"SecondLife")));
		ensure("1. getTypeEnum failed", nValue1.getTypeEnum() == NVT_STRING);
		ensure("1. getClassEnum failed", nValue1.getClassEnum() == NVC_READ_WRITE);
		ensure("1. getSendtoEnum failed", nValue1.getSendtoEnum() == NVS_SIM);
		ensure("1. getString failed", (0==strcmp(nValue1.getString(),"232324343")));

		LLNameValue nValue2("SecondLife", "23.5", "F32", "R");
		ensure("2. getTypeEnum failed", nValue2.getTypeEnum() == NVT_F32);
		ensure("2. getClassEnum failed", nValue2.getClassEnum() == NVC_READ_ONLY);
		ensure("2. getSendtoEnum failed", nValue2.getSendtoEnum() == NVS_SIM);
		ensure("2. getF32 failed", *nValue2.getF32() == 23.5f);

		LLNameValue nValue3("SecondLife", "-43456787", "S32", "READ_ONLY");
		ensure("3. getTypeEnum failed", nValue3.getTypeEnum() == NVT_S32);
		ensure("3. getClassEnum failed", nValue3.getClassEnum() == NVC_READ_ONLY);
		ensure("3. getSendtoEnum failed", nValue3.getSendtoEnum() == NVS_SIM);
		ensure("3. getS32 failed", *nValue3.getS32() == -43456787);

		LLNameValue nValue4("SecondLife", "<1.0, 2.0, 3.0>", "VEC3", "RW");
		LLVector3 llvec4(1.0, 2.0, 3.0);
		ensure("4. getTypeEnum failed", nValue4.getTypeEnum() == NVT_VEC3);
		ensure("4. getClassEnum failed", nValue4.getClassEnum() == NVC_READ_WRITE);
		ensure("4. getSendtoEnum failed", nValue4.getSendtoEnum() == NVS_SIM);
		ensure("4. getVec3 failed", *nValue4.getVec3() == llvec4);

		LLNameValue nValue5("SecondLife", "-1.0, 2.4, 3", "VEC3", "RW");
		LLVector3 llvec5(-1.0f, 2.4f, 3);
		ensure("5. getTypeEnum failed", nValue5.getTypeEnum() == NVT_VEC3);
		ensure("5. getClassEnum failed", nValue5.getClassEnum() == NVC_READ_WRITE);
		ensure("5. getSendtoEnum failed", nValue5.getSendtoEnum() == NVS_SIM);
		ensure("5. getVec3 failed", *nValue5.getVec3() == llvec5);

		LLNameValue nValue6("SecondLife", "89764323", "U32", "RW");
		ensure("6. getTypeEnum failed", nValue6.getTypeEnum() == NVT_U32);
		ensure("6. getClassEnum failed", nValue6.getClassEnum() == NVC_READ_WRITE);
		ensure("6. getSendtoEnum failed", nValue6.getSendtoEnum() == NVS_SIM);
		ensure("6. getU32 failed", *nValue6.getU32() == 89764323);

		LLNameValue nValue7("SecondLife", "89764323323232", "U64", "RW");
		U64 u64_7 = U64L(89764323323232);
		ensure("7. getTypeEnum failed", nValue7.getTypeEnum() == NVT_U64);
		ensure("7. getClassEnum failed", nValue7.getClassEnum() == NVC_READ_WRITE);
		ensure("7. getSendtoEnum failed", nValue7.getSendtoEnum() == NVS_SIM);
		ensure("7. getU32 failed", *nValue7.getU64() == u64_7);
	}
Beispiel #4
0
	void namevalue_object_t::test<19>()
	{
		LLNameValue nValue1(" SecondLife S32 RW SIM 22222");
		LLNameValue nValue2(" Virtual F32 RW SIM 44444");
		LLNameValue nValue3(" SecondLife F32");
		nValue3 = nValue1 / nValue2;
		ensure_equals("1:operator/ failed",*nValue3.getF32(),0.5);
		
		LLNameValue nValue4(" SecondLife F32 RW SIM 33333");
		LLNameValue nValue5(" SecondLife S32 RW SIM 22222");
		LLNameValue nValue6(" SecondLife F32");
		nValue6 = nValue4 / nValue5;
		ensure_equals("2:operator/ failed",*nValue6.getF32(),1.5);
	}
Beispiel #5
0
	void namevalue_object_t::test<25>()
	{
		LLNameValue nValue1(" SecondLife STRING RW SIM 33333");
		LLNameValue nValue2(" Virtual STRING RW SIM 33333");
		bool b_ret = (nValue1 > nValue2) ? 1 : 0;
		ensure("1:operator> failed",!b_ret);	

		LLNameValue nValue3(" SecondLife F32 RW SIM 11111");
		LLNameValue nValue4(" Virtual F32 RW SIM 22222");
		b_ret = (nValue3 > nValue4) ? 1 : 0;
		ensure("2:operator> failed",!b_ret);

		LLNameValue nValue5(" SecondLife S32 RW SIM 22222");
		LLNameValue nValue6(" Virtual F32 RW SIM 11111");
		b_ret = (nValue5 > nValue6) ? 1 : 0;
		ensure("3:operator> failed",b_ret);
	}
Beispiel #6
0
	void namevalue_object_t::test<27>()
	{
		LLNameValue nValue1(" SecondLife F32 RW SIM 33333");
		LLNameValue nValue2("Virtual");
		nValue2 = -nValue1;
		ensure_equals("1:operator unary- failed",*nValue2.getF32(), -33333.f);

		LLNameValue nValue3(" SecondLife U32 RW SIM 11111");
		LLNameValue nValue4("Virtual S32");
		nValue4 = -nValue3;
		ensure_equals("2:operator unary- failed",*nValue4.getS32(), -11111);

		LLNameValue nValue5(" SecondLife VEC3 RW SIM <1, 1, 1>");
		LLNameValue nValue6("Virtual VEC3");
		LLVector3 vec(-1, -1, -1);
		nValue6 = -nValue5;
		ensure_equals("3:operator unary- failed",*nValue6.getVec3(), vec);
	}	
Beispiel #7
0
	void namevalue_object_t::test<21>()
	{
		LLNameValue nValue1(" SecondLife STRING RW SIM 22222");
		LLNameValue nValue2(" Virtual STRING RW SIM 22222");
		ensure("1:operator== failed", nValue1 == nValue2);

		LLNameValue nValue3(" SecondLife F32 RW SIM 33333");
		LLNameValue nValue4(" Virtual F32 RW SIM 22222");
		ensure("2:operator== failed",!(nValue3 == nValue4));

		LLNameValue nValue5(" SecondLife STRING RW SIM 22222");
		LLNameValue nValue6(" Virtual STRING RW SIM 33333");
		ensure("3:operator== failed",!(nValue5 == nValue6));

		LLNameValue nValue7(" SecondLife VEC3 RW SIM <2, 2, 2>");
		LLNameValue nValue8(" Virtual VEC3 RW SIM <2, 2, 2>");
		ensure("4:operator== failed",(nValue7 == nValue8));		
	}
Beispiel #8
0
	void namevalue_object_t::test<20>()
	{
		LLNameValue nValue1(" SecondLife S32 RW SIM 22222");
		LLNameValue nValue2(" Virtual S32 RW SIM 33333");
		LLNameValue nValue3(" SecondLife S32");
 		nValue3 = nValue1 % nValue2;
		ensure_equals("1:operator% failed",*nValue3.getS32(),22222);

		LLNameValue nValue4(" SecondLife U32 RW SIM 3");
		LLNameValue nValue5(" SecondLife S32 RW SIM 2");
		LLNameValue nValue6(" SecondLife S32");
		nValue6 = nValue4 % nValue5;
		ensure_equals("2:operator% failed",*nValue6.getS32(),1);

		LLNameValue nValue10(" SecondLife VEC3 RW SIM <4, 5, 6>");
		LLNameValue nValue11(" SecondLife VEC3 RW SIM <1, 2, 3>");
		LLNameValue nValue12(" SecondLife VEC3");
		LLVector3 vec1(4,5,6);
		LLVector3 vec2(1,2,3);
		LLVector3 vec3(vec1 % vec2);
		nValue12 = nValue10 % nValue11;
		ensure_equals("5:operator% failed",*nValue12.getVec3(), vec3);
	}
Beispiel #9
0
	void namevalue_object_t::test<18>()
	{

		LLNameValue nValue1(" SecondLife F32 RW SIM 22222");
		LLNameValue nValue2(" SecondLife F32 RW SIM 33333");
		LLNameValue nValue3(" SecondLife F32");
		nValue3 = nValue1 * nValue2;
		ensure_equals("1:operator* failed",*nValue3.getF32(),740725926.f);
		
		LLNameValue nValue4(" SecondLife S32 RW SIM 22222");
		LLNameValue nValue5(" SecondLife  F32 RW SIM 33333");
		LLNameValue nValue6(" SecondLife F32");
		nValue6 = nValue4 * nValue5;
		ensure_equals("2:operator* failed",*nValue6.getF32(),740725926.f);

		LLNameValue nValue10(" SecondLife VEC3 RW SIM <2, 2, 2>");
		LLNameValue nValue11(" SecondLife VEC3 RW SIM <3, 3, 3>");
		LLNameValue nValue12(" SecondLife F32");
		LLVector3 vec1(2,2,2);
		LLVector3 vec2(3,3,3);
		nValue12 = nValue10 * nValue11;
		ensure_equals("2:operator* failed",*nValue12.getF32(), (vec1 * vec2));
	}
Beispiel #10
0
	void namevalue_object_t::test<2>()
	{
		LLNameValue nValue(" SecondLife ASSET RW S 232324343");
		ensure("mName not set correctly", (0 == strcmp(nValue.mName,"SecondLife")));
		ensure("getTypeEnum failed", nValue.getTypeEnum() == NVT_ASSET);
		ensure("getClassEnum failed", nValue.getClassEnum() == NVC_READ_WRITE);
		ensure("getSendtoEnum failed", nValue.getSendtoEnum() == NVS_SIM);
		ensure("getString failed", (0==strcmp(nValue.getAsset(),"232324343")));
		ensure("sendToData or sendToViewer failed", !nValue.sendToData() && !nValue.sendToViewer());
		
		LLNameValue nValue1("\n\r SecondLife_1 STRING READ_WRITE SIM 232324343");
		ensure("1. mName not set correctly", (0 == strcmp(nValue1.mName,"SecondLife_1")));
		ensure("1. getTypeEnum failed", nValue1.getTypeEnum() == NVT_STRING);
		ensure("1. getClassEnum failed", nValue1.getClassEnum() == NVC_READ_WRITE);
		ensure("1. getSendtoEnum failed", nValue1.getSendtoEnum() == NVS_SIM);
		ensure("1. getString failed", (0==strcmp(nValue1.getString(),"232324343")));
		ensure("1. sendToData or sendToViewer failed", !nValue1.sendToData() && !nValue1.sendToViewer());

		LLNameValue nValue2("SecondLife", "23.5", "F32", "R", "DS");
		ensure("2. getTypeEnum failed", nValue2.getTypeEnum() == NVT_F32);
		ensure("2. getClassEnum failed", nValue2.getClassEnum() == NVC_READ_ONLY);
		ensure("2. getSendtoEnum failed", nValue2.getSendtoEnum() == NVS_DATA_SIM);
		ensure("2. getF32 failed", *nValue2.getF32() == 23.5f);
		ensure("2. sendToData or sendToViewer failed", nValue2.sendToData() && !nValue2.sendToViewer());

		LLNameValue nValue3("SecondLife", "-43456787", "S32", "READ_ONLY", "SIM_SPACE");
		ensure("3. getTypeEnum failed", nValue3.getTypeEnum() == NVT_S32);
		ensure("3. getClassEnum failed", nValue3.getClassEnum() == NVC_READ_ONLY);
		ensure("3. getSendtoEnum failed", nValue3.getSendtoEnum() == NVS_DATA_SIM);
		ensure("3. getS32 failed", *nValue3.getS32() == -43456787);
		ensure("sendToData or sendToViewer failed", nValue3.sendToData() && !nValue3.sendToViewer());

		LLNameValue nValue4("SecondLife", "<1.0, 2.0, 3.0>", "VEC3", "RW", "SV");
		LLVector3 llvec4(1.0, 2.0, 3.0);
		ensure("4. getTypeEnum failed", nValue4.getTypeEnum() == NVT_VEC3);
		ensure("4. getClassEnum failed", nValue4.getClassEnum() == NVC_READ_WRITE);
		ensure("4. getSendtoEnum failed", nValue4.getSendtoEnum() == NVS_SIM_VIEWER);
		ensure("4. getVec3 failed", *nValue4.getVec3() == llvec4);
		ensure("4. sendToData or sendToViewer failed", !nValue4.sendToData() && nValue4.sendToViewer());

		LLNameValue nValue5("SecondLife", "-1.0, 2.4, 3", "VEC3", "RW", "SIM_VIEWER");
		LLVector3 llvec5(-1.0f, 2.4f, 3);
		ensure("5. getTypeEnum failed", nValue5.getTypeEnum() == NVT_VEC3);
		ensure("5. getClassEnum failed", nValue5.getClassEnum() == NVC_READ_WRITE);
		ensure("5. getSendtoEnum failed", nValue5.getSendtoEnum() == NVS_SIM_VIEWER);
		ensure("5. getVec3 failed", *nValue5.getVec3() == llvec5);
		ensure("5. sendToData or sendToViewer failed", !nValue5.sendToData() && nValue5.sendToViewer());

		LLNameValue nValue6("SecondLife", "89764323", "U32", "RW", "DSV");
		ensure("6. getTypeEnum failed", nValue6.getTypeEnum() == NVT_U32);
		ensure("6. getClassEnum failed", nValue6.getClassEnum() == NVC_READ_WRITE);
		ensure("6. getSendtoEnum failed", nValue6.getSendtoEnum() == NVS_DATA_SIM_VIEWER);
		ensure("6. getU32 failed", *nValue6.getU32() == 89764323);
		ensure("6. sendToData or sendToViewer failed", nValue6.sendToData() && nValue6.sendToViewer());

		LLNameValue nValue7("SecondLife", "89764323323232", "U64", "RW", "SIM_SPACE_VIEWER");
		U64 u64_7 = U64L(89764323323232);
		ensure("7. getTypeEnum failed", nValue7.getTypeEnum() == NVT_U64);
		ensure("7. getClassEnum failed", nValue7.getClassEnum() == NVC_READ_WRITE);
		ensure("7. getSendtoEnum failed", nValue7.getSendtoEnum() == NVS_DATA_SIM_VIEWER);
		ensure("7. getU32 failed", *nValue7.getU64() == u64_7);
		ensure("7. sendToData or sendToViewer failed", nValue7.sendToData() && nValue7.sendToViewer());
	}