void TestReflectionObject::test<1>() { // Check properties can be found. const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); const LLMetaProperty* null = NULL; ensure_not_equals(meta_class.findProperty("mInt"), null); ensure_not_equals(meta_class.findProperty("mString"), null); }
void TestReflectionObject::test<10>() { // Check meta classes of different types do not compare equal. const LLMetaClass* reflection_data_meta_class = &(LLMetaClassT<TestReflectionData>::instance()); const LLMetaClass* aggregated_data_meta_class = &(LLMetaClassT<TestAggregatedData>::instance()); ensure_not_equals(reflection_data_meta_class, aggregated_data_meta_class); }
void processor_object_t::test<1>() { set_test_name("LLProcessorInfo regression test"); LLProcessorInfo pi; F64 freq = pi.getCPUFrequency(); //bool sse = pi.hasSSE(); //bool sse2 = pi.hasSSE2(); //bool alitvec = pi.hasAltivec(); std::string family = pi.getCPUFamilyName(); std::string brand = pi.getCPUBrandName(); //std::string steam = pi.getCPUFeatureDescription(); ensure_not_equals("Unknown Brand name", brand, "Unknown"); ensure_not_equals("Unknown Family name", family, "Unknown"); ensure("Reasonable CPU Frequency > 100 && < 10000", freq > 100 && freq < 10000); }
void TestReflectionObject::test<7>() { // Check reflective property has correct value. const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); const LLReflective* null = NULL; const LLReflective* ref = meta_class.findProperty("mObj")->get(this); ensure_not_equals(ref, null); }
void SDTestObject::test<2>() // setting and fetching scalar types { SDCleanupCheck check; LLSD v; v = true; ensureTypeAndValue("set true", v, true); v = false; ensureTypeAndValue("set false", v, false); v = true; ensureTypeAndValue("set true again", v, true); v = 42; ensureTypeAndValue("set to 42", v, 42); v = 0; ensureTypeAndValue("set to zero", v, 0); v = -12345; ensureTypeAndValue("set to neg", v, -12345); v = 2000000000; ensureTypeAndValue("set to big", v, 2000000000); v = 3.14159265359; ensureTypeAndValue("set to pi", v, 3.14159265359); ensure_not_equals("isn't float", v.asReal(), (float)3.14159265359); v = 6.7e256; ensureTypeAndValue("set to big", v, 6.7e256); LLUUID nullUUID; LLUUID newUUID; newUUID.generate(); v = nullUUID; ensureTypeAndValue("set to null UUID", v, nullUUID); v = newUUID; ensureTypeAndValue("set to new UUID", v, newUUID); v = nullUUID; ensureTypeAndValue("set to null again", v, nullUUID); // strings must be tested with two types of string objects std::string s = "now is the time"; const char* cs = "for all good zorks"; v = s; ensureTypeAndValue("set to std::string", v, s); v = cs; ensureTypeAndValue("set to const char*", v, cs); LLDate epoch; LLDate aDay("2001-10-22T10:11:12.00Z"); v = epoch; ensureTypeAndValue("set to epoch", v, epoch); v = aDay; ensureTypeAndValue("set to a day", v, aDay); LLURI path("http://slurl.com/secondlife/Ambleside/57/104/26/"); v = path; ensureTypeAndValue("set to a uri", v, path); const char source[] = "once in a blue moon"; std::vector<U8> data; copy(&source[0], &source[sizeof(source)], back_inserter(data)); v = data; ensureTypeAndValue("set to data", v, data); v.clear(); ensure("reset to undefined", v.type() == LLSD::TypeUndefined); }
void permission_object_t::test<19>() { LLPermissions perm,perm1; LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); perm.init(creator,owner,lastOwner,group); ensure_not_equals("2:Operator==:failed ", perm, perm1); }
void object::test<4>() { geos::geom::Triangle abc(a, b, c); geos::geom::Triangle copy(d, e, f); ensure_equals( abc.p0, a ); ensure_equals( abc.p1, b ); ensure_equals( abc.p2, c ); ensure_equals( copy.p0, d ); ensure_equals( copy.p1, e ); ensure_equals( copy.p2, f ); copy = abc; ensure_equals( copy.p0, a ); ensure_equals( copy.p1, b ); ensure_equals( copy.p2, c ); ensure_not_equals( copy.p0, d ); ensure_not_equals( copy.p1, e ); ensure_not_equals( copy.p2, f ); }
void LLTemplateMessageBuilderTestObject::test<21>() // block appended in declaration -> data appended in binary { U8 buffer1[MAX_BUFFER_SIZE]; memset(buffer1, 0, MAX_BUFFER_SIZE); U8 buffer2[MAX_BUFFER_SIZE]; memset(buffer2, 0, MAX_BUFFER_SIZE); U32 bufferSize1, bufferSize2; // Build template: Test0 only LLMessageTemplate messageTemplate = defaultTemplate(); messageTemplate.addBlock(createBlock(const_cast<char*>(_PREHASH_Test0), MVT_U32, 4, MBT_SINGLE)); // Build message LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, const_cast<char*>(_PREHASH_Test0)); builder->addU32(_PREHASH_Test0, 0xaaaa); bufferSize1 = builder->buildMessage(buffer1, MAX_BUFFER_SIZE, 0); delete builder; // Build template: Test0 before Test1 messageTemplate = defaultTemplate(); messageTemplate.addBlock(createBlock(const_cast<char*>(_PREHASH_Test0), MVT_U32, 4, MBT_SINGLE)); messageTemplate.addBlock(createBlock(const_cast<char*>(_PREHASH_Test1), MVT_U32, 4, MBT_SINGLE)); // Build message builder = defaultBuilder(messageTemplate, const_cast<char*>(_PREHASH_Test0)); builder->addU32(_PREHASH_Test0, 0xaaaa); builder->nextBlock(_PREHASH_Test1); builder->addU32(_PREHASH_Test0, 0xbbbb); bufferSize2 = builder->buildMessage(buffer2, MAX_BUFFER_SIZE, 0); delete builder; ensure_not_equals("Ensure Buffer Sizes Not Equal", bufferSize1, bufferSize2); ensure_equals("Ensure Buffer Prefix Equal", memcmp(buffer1, buffer2, bufferSize1), 0); ensure_not_equals("Ensure Buffer Contents Not Equal", memcmp(buffer1, buffer2, bufferSize2), 0); }
void llprimitive_object_t::test<6>() { set_test_name("Test setVolume creation of new NOT-unique volume."); LLPrimitive primitive; LLVolumeParams params; // Make sure volume starts off null ensure(primitive.getVolume() == NULL); // Make sure we have no texture entries before setting the volume ensure_equals(primitive.getNumTEs(), 0); // Test that GEOMETRY has not been flagged as changed. ensure(!primitive.isChanged(LLXform::GEOMETRY)); // Make sure setVolume returns true ensure(primitive.setVolume(params, 0, false) == TRUE); LLVolume* new_volume = primitive.getVolume(); // make sure new volume was actually created ensure(new_volume != NULL); // Make sure that now that we've set the volume we have texture entries ensure_not_equals(primitive.getNumTEs(), 0); // Make sure that the number of texture entries equals the number of faces in the volume (should be 6) ensure_equals(new_volume->getNumFaces(), 6); ensure_equals(primitive.getNumTEs(), new_volume->getNumFaces()); // Test that GEOMETRY has been flagged as changed. ensure(primitive.isChanged(LLXform::GEOMETRY)); // Run it twice to make sure it doesn't create a different one if params are the same ensure(primitive.setVolume(params, 0, false) == FALSE); ensure(new_volume == primitive.getVolume()); // Change the param definition and try setting it again. params.setRevolutions(4); ensure(primitive.setVolume(params, 0, false) == TRUE); // Ensure that we now have a different volume ensure(new_volume != primitive.getVolume()); }
void inventory_object::test<6>() { LLPointer<LLInventoryItem> src = create_random_inventory_item(); LLUUID new_item_id, new_parent_id; new_item_id.generate(); src->setUUID(new_item_id); new_parent_id.generate(); src->setParent(new_parent_id); LLString new_name = "LindenLab"; src->rename(new_name); src->setType(LLAssetType::AT_SOUND); LLUUID new_asset_id; new_asset_id.generate(); src->setAssetUUID(new_asset_id); LLString new_desc = "SecondLife Testing"; src->setDescription(new_desc); S32 new_price = rand(); LLSaleInfo new_sale_info(LLSaleInfo::FS_COPY, new_price); src->setSaleInfo(new_sale_info); U32 new_flags = rand(); S32 new_creation = time(NULL); LLPermissions new_perm; LLUUID new_creator_id; new_creator_id.generate(); LLUUID new_owner_id; new_owner_id.generate(); LLUUID last_owner_id; last_owner_id.generate(); LLUUID new_group_id; new_group_id.generate(); new_perm.init(new_creator_id, new_owner_id, last_owner_id, new_group_id); new_perm.initMasks(PERM_ALL, PERM_ALL, PERM_COPY, PERM_COPY, PERM_MODIFY | PERM_COPY); src->setPermissions(new_perm); src->setInventoryType(LLInventoryType::IT_SOUND); src->setFlags(new_flags); src->setCreationDate(new_creation); LLSD sd = ll_create_sd_from_inventory_item(src); LLPointer<LLInventoryItem> dst = ll_create_item_from_sd(sd); LLPointer<LLInventoryItem> src1 = create_random_inventory_item(); src1->copy(src); src1->clone(src); ensure_equals("1.item id::getUUID() failed", dst->getUUID(), src1->getUUID()); ensure_equals("2.parent::getParentUUID() failed", dst->getParentUUID(), src1->getParentUUID()); ensure_equals("3.name::getName() failed", dst->getName(), src1->getName()); ensure_equals("4.type::getType() failed", dst->getType(), src1->getType()); ensure_equals("5.permissions::getPermissions() failed", dst->getPermissions(), src1->getPermissions()); ensure_equals("6.description::getDescription() failed", dst->getDescription(), src1->getDescription()); ensure_equals("7.sale type::getSaleType() failed type", dst->getSaleInfo().getSaleType(), src1->getSaleInfo().getSaleType()); ensure_equals("8.sale price::getSalePrice() failed price", dst->getSaleInfo().getSalePrice(), src1->getSaleInfo().getSalePrice()); ensure_equals("9.asset id::getAssetUUID() failed id", dst->getAssetUUID(), src1->getAssetUUID()); ensure_equals("10.inventory type::getInventoryType() failed type", dst->getInventoryType(), src1->getInventoryType()); ensure_equals("11.flags::getFlags() failed", dst->getFlags(), src1->getFlags()); ensure_equals("12.creation::getCreationDate() failed", dst->getCreationDate(), src1->getCreationDate()); LLPointer<LLInventoryItem> src2; src1->clone(src2); ensure_not_equals("13.item id::getUUID() failed", src1->getUUID(), src2->getUUID()); ensure_equals("14.parent::getParentUUID() failed", src2->getParentUUID(), src1->getParentUUID()); ensure_equals("15.name::getName() failed", src2->getName(), src1->getName()); ensure_equals("16.type::getType() failed", src2->getType(), src1->getType()); ensure_equals("17.permissions::getPermissions() failed", src2->getPermissions(), src1->getPermissions()); ensure_equals("18.description::getDescription() failed", src2->getDescription(), src1->getDescription()); ensure_equals("19.sale type::getSaleType() failed type", src2->getSaleInfo().getSaleType(), src1->getSaleInfo().getSaleType()); ensure_equals("20.sale price::getSalePrice() failed price", src2->getSaleInfo().getSalePrice(), src1->getSaleInfo().getSalePrice()); ensure_equals("21.asset id::getAssetUUID() failed id", src2->getAssetUUID(), src1->getAssetUUID()); ensure_equals("22.inventory type::getInventoryType() failed type", src2->getInventoryType(), src1->getInventoryType()); ensure_equals("23.flags::getFlags() failed", src2->getFlags(), src1->getFlags()); ensure_equals("24.creation::getCreationDate() failed", src2->getCreationDate(), src1->getCreationDate()); }
void inventory_object::test<6>() { LLPointer<LLInventoryItem> src = create_random_inventory_item(); LLUUID new_item_id, new_parent_id; new_item_id.generate(); src->setUUID(new_item_id); new_parent_id.generate(); src->setParent(new_parent_id); std::string new_name = "LindenLab"; src->rename(new_name); src->setType(LLAssetType::AT_SOUND); LLUUID new_asset_id; new_asset_id.generate(); src->setAssetUUID(new_asset_id); std::string new_desc = "GIS Testing"; src->setDescription(new_desc); S32 new_price = rand(); LLSaleInfo new_sale_info(LLSaleInfo::FS_COPY, new_price); src->setSaleInfo(new_sale_info); U32 new_flags = rand(); S32 new_creation = time(NULL); LLPermissions new_perm; LLUUID new_creator_id; new_creator_id.generate(); LLUUID new_owner_id; new_owner_id.generate(); LLUUID last_owner_id; last_owner_id.generate(); LLUUID new_group_id; new_group_id.generate(); new_perm.init(new_creator_id, new_owner_id, last_owner_id, new_group_id); new_perm.initMasks(PERM_ALL, PERM_ALL, PERM_COPY, PERM_COPY, PERM_MODIFY | PERM_COPY); src->setPermissions(new_perm); src->setInventoryType(LLInventoryType::IT_SOUND); src->setFlags(new_flags); src->setCreationDate(new_creation); // test a save/load cycle to LLSD and back again LLSD sd = ll_create_sd_from_inventory_item(src); LLPointer<LLInventoryItem> dst = new LLInventoryItem; bool successful_parse = dst->fromLLSD(sd); ensure_equals("0.LLInventoryItem::fromLLSD()", successful_parse, true); LLPointer<LLInventoryItem> src1 = create_random_inventory_item(); src1->copyItem(src); ensure_equals("1.item id::getUUID() failed", dst->getUUID(), src1->getUUID()); ensure_equals("2.parent::getParentUUID() failed", dst->getParentUUID(), src1->getParentUUID()); ensure_equals("3.name::getName() failed", dst->getName(), src1->getName()); ensure_equals("4.type::getType() failed", dst->getType(), src1->getType()); ensure_equals("5.permissions::getPermissions() failed", dst->getPermissions(), src1->getPermissions()); ensure_equals("6.description::getDescription() failed", dst->getDescription(), src1->getDescription()); ensure_equals("7.sale type::getSaleType() failed type", dst->getSaleInfo().getSaleType(), src1->getSaleInfo().getSaleType()); ensure_equals("8.sale price::getSalePrice() failed price", dst->getSaleInfo().getSalePrice(), src1->getSaleInfo().getSalePrice()); ensure_equals("9.asset id::getAssetUUID() failed id", dst->getAssetUUID(), src1->getAssetUUID()); ensure_equals("10.inventory type::getInventoryType() failed type", dst->getInventoryType(), src1->getInventoryType()); ensure_equals("11.flags::getFlags() failed", dst->getFlags(), src1->getFlags()); ensure_equals("12.creation::getCreationDate() failed", dst->getCreationDate(), src1->getCreationDate()); // quick test to make sure generateUUID() really works src1->generateUUID(); ensure_not_equals("13.item id::generateUUID() failed", src->getUUID(), src1->getUUID()); }