TEST_F(CTestInterfaceBase, GetTestCase_08_dateExpired) { data_entry key1("04_08_key_01"); data_entry value1("04_08_data_01"); data_entry key2("04_08_key_02"); data_entry value2("04_08_data_02"); data_entry value3("04_08_data_03"); data_entry* p; int ret = 0; //data1:area equals,key not equal DO_WITH_RETRY(client_handle.put(1, key1, value1, 0, 0), ret, TAIR_RETURN_SUCCESS); ASSERT_EQ(TAIR_RETURN_SUCCESS, ret); //data2:area not equas, key equal DO_WITH_RETRY(client_handle.put(2, key2, value2, 0, 0), ret, TAIR_RETURN_SUCCESS); ASSERT_EQ(TAIR_RETURN_SUCCESS, ret); DO_WITH_RETRY(client_handle.put(1, key2, value3, 1, 0), ret, TAIR_RETURN_SUCCESS); ASSERT_EQ(TAIR_RETURN_SUCCESS, ret); sleep(2); ret = client_handle.get(1, key2, p); ASSERT_EQ(TAIR_RETURN_DATA_EXPIRED, ret); client_handle.remove(1, key1); client_handle.remove(2, key2); client_handle.remove(1, key2); }
TEST_F(CTestInterfaceBase, GetTestCase_07_dateNotExpire) { data_entry key1("04_07_key_01"); data_entry value1("04_07_data_01"); data_entry key2("04_07_key_02"); data_entry value2("04_07_data_02"); data_entry value3("04_07_data_03"); data_entry* p; int ret = 0; //data1:area equals,key not equal DO_WITH_RETRY(client_handle.put(1, key1, value1, 0, 0), ret, TAIR_RETURN_SUCCESS); ASSERT_EQ(TAIR_RETURN_SUCCESS, ret); //data2:area not equas, key equal DO_WITH_RETRY(client_handle.put(2, key2, value2, 0, 0), ret, TAIR_RETURN_SUCCESS); ASSERT_EQ(TAIR_RETURN_SUCCESS, ret); DO_WITH_RETRY(client_handle.put(1, key2, value3, 3, 0), ret, TAIR_RETURN_SUCCESS); ASSERT_EQ(TAIR_RETURN_SUCCESS, ret); ret = client_handle.get(1, key2, p); ASSERT_EQ(TAIR_RETURN_SUCCESS, ret); ASSERT_EQ(true, compareDataValue(value3, *p)); delete p; p = NULL; client_handle.remove(1, key1); client_handle.remove(2, key2); client_handle.remove(1, key2); }
//modulo bool test_moduloSamePrimType() { bool status = false; INT value1(TEST_VALUE_1); int value2 = TEST_VALUE_2; INT value3(0); value3 = value1 % value2; status = (value3==TEST_VALUE_1%TEST_VALUE_2 && TEST_VALUE_1!=TEST_VALUE_2 && value1==TEST_VALUE_1 && value2==TEST_VALUE_2); return status; }
bool test_divideCompatibleType() { bool status = false; INT value1(TEST_VALUE_1); DOUBLE value2 = TEST_VALUE_2; INT value3(0); value3 = value1 / value2; status = (value3==TEST_VALUE_1/TEST_VALUE_2 && TEST_VALUE_1!=TEST_VALUE_2 && value1==TEST_VALUE_1 && value2==TEST_VALUE_2); return status; }
bool test_multiplySameType() { bool status = false; INT value1(TEST_VALUE_1); INT value2 = TEST_VALUE_2; INT value3(0); value3 = value1 * value2; status = (value3==TEST_VALUE_1*TEST_VALUE_2 && TEST_VALUE_1!=TEST_VALUE_2 && value1==TEST_VALUE_1 && value2==TEST_VALUE_2); return status; }
bool test_subtractCompatiblePrimType() { bool status = false; INT value1(TEST_VALUE_1); double value2 = TEST_VALUE_2; INT value3(0); value3 = value1 - value2; status = (value3==TEST_VALUE_1-TEST_VALUE_2 && TEST_VALUE_1!=TEST_VALUE_2 && value1==TEST_VALUE_1 && value2==TEST_VALUE_2); return status; }
bool test_subtractSameType() { bool status = false; INT value1(TEST_VALUE_1); INT value2 = TEST_VALUE_2; INT value3(0); value3 = value1 - value2; status = (value3==TEST_VALUE_1-TEST_VALUE_2 && TEST_VALUE_1!=TEST_VALUE_2 && value1==TEST_VALUE_1 && value2==TEST_VALUE_2); return status; }
bool test_addSameType() { bool status = false; INT value1(TEST_VALUE_1); INT value2 = TEST_VALUE_2; INT value3(0); value3 = value1 + value2; status = (value3==TEST_VALUE_1+TEST_VALUE_2 && TEST_VALUE_1!=TEST_VALUE_2 && value1==TEST_VALUE_1 && value2==TEST_VALUE_2); return status; }
bool test_moduloCompatibleType() { bool status = false; INT value1(TEST_VALUE_1); LONG_INT value2 = TEST_VALUE_2; INT value3(0); value3 = value1 % value2; status = (value3==TEST_VALUE_1%TEST_VALUE_2 && TEST_VALUE_1!=TEST_VALUE_2 && value1==TEST_VALUE_1 && value2==TEST_VALUE_2); return status; }
bool test_multiplyCompatiblePrimType() { bool status = false; INT value1(TEST_VALUE_1); double value2 = TEST_VALUE_2; INT value3(0); value3 = value1 * value2; status = (value3==TEST_VALUE_1*TEST_VALUE_2 && TEST_VALUE_1!=TEST_VALUE_2 && value1==TEST_VALUE_1 && value2==TEST_VALUE_2); return status; }
// ----------------------------------------------------------------------------- // CTestPlatAlfVisual::TestTimedValueConstructor // ----------------------------------------------------------------------------- // TInt CTestPlatAlfVisual::TestTimedValueConstructor( CStifItemParser& /*aItem*/ ) { // Print to UI _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); _LIT( KTestTimedValueConstructor, "TestTimedValueConstructor" ); TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestTimedValueConstructor ); // Print to log file iLog->Log( KTestTimedValueConstructor ); TAlfTimedValue value1; TAlfTimedValue value2( 1.0 ); TAlfTimedValue value3( 1.0, 1 ); return KErrNone; }
uint32_t hash_domain_slash(const char *p) { uint32_t v; int i; v = 0; i = 4; do { v *= 38; if (*p != '/') v += value3(*p++) + 1; } while (--i); return v; }
int main(int argc,char** argv) { GLDebugDrawer gDebugDrawer; ///testing the btHashMap btHashMap<btHashKey<OurValue>,OurValue> map; OurValue value1(btVector3(2,3,4)); btHashKey<OurValue> key1(value1.getUid()); map.insert(key1,value1); OurValue value2(btVector3(5,6,7)); btHashKey<OurValue> key2(value2.getUid()); map.insert(key2,value2); { OurValue value3(btVector3(7,8,9)); btHashKey<OurValue> key3(value3.getUid()); map.insert(key3,value3); } map.remove(key2); const OurValue* ourPtr = map.find(key1); for (int i=0;i<map.size();i++) { OurValue* tmp = map.getAtIndex(i); //printf("tmp value=%f,%f,%f\n",tmp->m_position.getX(),tmp->m_position.getY(),tmp->m_position.getZ()); } BasicDemo ccdDemo; ccdDemo.initPhysics(); ccdDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer); #ifdef CHECK_MEMORY_LEAKS ccdDemo.exitPhysics(); #else return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",&ccdDemo); #endif //default glut doesn't return from mainloop return 0; }
void ColorTest::configuration() { Corrade::Utility::Configuration c; Color3f color3(0.5f, 0.75f, 1.0f); std::string value3("0.5 0.75 1"); c.setValue("color3", color3); CORRADE_COMPARE(c.value("color3"), value3); CORRADE_COMPARE(c.value<Color3f>("color3"), color3); Color4f color4(0.5f, 0.75f, 0.0f, 1.0f); std::string value4("0.5 0.75 0 1"); c.setValue("color4", color4); CORRADE_COMPARE(c.value("color4"), value4); CORRADE_COMPARE(c.value<Color4f>("color4"), color4); }
void TrapList::makeAlarmTrapDatagram(Alarm_Trap_type_E type, AlarmRecord *record) { if( !inited ) { return; } if (record == NULL) return; /*检查trapbuf是否满*/ if (endIndex != currentIndex) { //�Ƿ�buffer������� ���� if ((endIndex == TrapMaxNumber - 1) && currentIndex == 0) { return; } else if ((endIndex + 1) == currentIndex) { return; } } /*VBS 初始化*/ OIDImplTrapItem[10] = 3; OIDImplEventID[10] = 2; SNMPPdu pdu; pdu.commond = SNMPPdu::TRAP; VariableBinding vb[5]; pdu.variableBindings.variableBinding = vb; pdu.variableBindings.vbsLength = 5; /*1.3.6.1.2.1.1.3.0 Timeticks*/ OID oid1(OIDImplTimeticks, 9); pdu.variableBindings.getAt(0)->setOID(&oid1); TimeTicks value1(record->itsRaiseTime()); pdu.variableBindings.getAt(0)->setValue(&value1); /*1.3.6.1.6.3.1.1.4.1.0 TrapOID*/ /*1.3.6.1.4.1.25449.1.1.12.2.type alarmType*/ OID oid2(OIDTrapFix, 11); pdu.variableBindings.getAt(1)->setOID(&oid2); OIDImplEventID[11] = record->itsAlarmType(); if( type == alarm_clear ) { OIDImplEventID[11] |= 0x8000; } OID value2(OIDImplEventID, 12); pdu.variableBindings.getAt(1)->setValue(&value2); /*1.3.6.1.4.1.25449.1.1.12.3.1 alarm sn*/ OIDImplTrapItem[11] = 1; OID oid3(OIDImplTrapItem, 12); pdu.variableBindings.getAt(2)->setOID(&oid3); Integer32 value3(record->itsSN()); pdu.variableBindings.getAt(2)->setValue(&value3); //Alarm source ID /*1.3.6.1.4.1.25449.1.1.12.3.2 Alarm source ID*/ OIDImplTrapItem[11] = 2; OID oid4(OIDImplTrapItem, 12); pdu.variableBindings.getAt(3)->setOID(&oid4); Integer32 value4(record->itsAlarmSource()); pdu.variableBindings.getAt(3)->setValue(&value4); //Alarm level /*1.3.6.1.4.1.25449.1.1.12.3.3 Alarm level*/ OIDImplTrapItem[11] = 3; OID oid5(OIDImplTrapItem, 12); pdu.variableBindings.getAt(4)->setOID(&oid5); Integer32 value5(record->itsAlarmLevel()); pdu.variableBindings.getAt(4)->setValue(&value5); int pklen = pdu.getPDUBerLength(); int buflen = pklen + 1 + SNMPPdu::getLengthBerLength(pklen); ///unsigned char *buf = new unsigned char[buflen]; if (pdu.encode((unsigned char*) trapBuffer[endIndex].buffer, buflen, pklen)) { trapBuffer[endIndex].buffersize = buflen; trapBuffer[endIndex].valid = 1; } else { trapBuffer[endIndex].buffersize = 0; trapBuffer[endIndex].valid = 0; } pdu.variableBindings.variableBinding = NULL; endIndex++; if (endIndex >= TrapMaxNumber) { endIndex = 0; } }
double calin::math::b_spline:: value3(double x, const std::vector<double>& c, double x0, double one_over_dx) { return value3(x, c.data(), c.size(), x0, one_over_dx); }
RcppExport SEXP xbrlProcessContexts(SEXP epaDoc) { xmlDocPtr doc = (xmlDocPtr) R_ExternalPtrAddr(epaDoc); xmlXPathContextPtr context = xmlXPathNewContext(doc); xmlXPathObjectPtr context_res = xmlXPathEvalExpression((xmlChar*) "//*[local-name()='context']", context); xmlNodeSetPtr context_nodeset = context_res->nodesetval; int context_nodeset_ln = context_nodeset->nodeNr; xmlXPathFreeContext(context); CharacterVector contextId(context_nodeset_ln); CharacterVector scheme(context_nodeset_ln); CharacterVector identifier(context_nodeset_ln); CharacterVector startDate(context_nodeset_ln); CharacterVector endDate(context_nodeset_ln); CharacterVector dimension1(context_nodeset_ln); CharacterVector value1(context_nodeset_ln); CharacterVector dimension2(context_nodeset_ln); CharacterVector value2(context_nodeset_ln); CharacterVector dimension3(context_nodeset_ln); CharacterVector value3(context_nodeset_ln); CharacterVector dimension4(context_nodeset_ln); CharacterVector value4(context_nodeset_ln); for (int i=0; i < context_nodeset_ln; i++) { xmlNodePtr context_node = context_nodeset->nodeTab[i]; xmlChar *tmp_str; if ((tmp_str = xmlGetProp(context_node, (xmlChar*) "id"))) { contextId[i] = (char *) tmp_str; xmlFree(tmp_str); } else { contextId[i] = NA_STRING; } scheme[i] = identifier[i] = startDate[i] = endDate[i] = dimension1[i] = value1[i] = dimension2[i] = value2[i] = dimension3[i] = value3[i] = dimension4[i] = value4[i] = NA_STRING; xmlNodePtr child_node = context_node->xmlChildrenNode; while (child_node) { if (!xmlStrcmp(child_node->name, (xmlChar*) "entity")) { xmlNodePtr gchild_node = child_node->xmlChildrenNode; while (gchild_node) { if (!xmlStrcmp(gchild_node->name, (xmlChar*) "identifier")) { if ((tmp_str = xmlGetProp(gchild_node, (xmlChar*) "scheme"))) { scheme[i] = (char *) tmp_str; xmlFree(tmp_str); } if ((tmp_str = xmlNodeListGetString(doc, gchild_node->xmlChildrenNode, 1))) { identifier[i] = (char *) tmp_str; xmlFree(tmp_str); } } else if (!xmlStrcmp(gchild_node->name, (xmlChar*) "segment")) { xmlNodePtr ggchild_node = gchild_node->xmlChildrenNode; int dimn = 1; while (ggchild_node) { if (!xmlStrcmp(ggchild_node->name, (xmlChar*) "explicitMember")) { if ((tmp_str = xmlGetProp(ggchild_node, (xmlChar*) "dimension"))) { if (dimn == 1) dimension1[i] = (char *) tmp_str; else if (dimn == 2) dimension2[i] = (char *) tmp_str; else if (dimn == 3) dimension3[i] = (char *) tmp_str; else if (dimn == 4) dimension4[i] = (char *) tmp_str; xmlFree(tmp_str); } if ((tmp_str = xmlNodeListGetString(doc, ggchild_node->xmlChildrenNode, 1))) { if (dimn == 1) value1[i] = (char *) tmp_str; else if (dimn == 2) value2[i] = (char *) tmp_str; else if (dimn == 3) value3[i] = (char *) tmp_str; else if (dimn == 4) value4[i] = (char *) tmp_str; xmlFree(tmp_str); } dimn++; } ggchild_node = ggchild_node->next; } } gchild_node = gchild_node->next; } } else if (!xmlStrcmp(child_node->name, (xmlChar*) "period")) { xmlNodePtr gchild_node = child_node->xmlChildrenNode; while (gchild_node) { if (!xmlStrcmp(gchild_node->name, (xmlChar*) "startDate")) { if ((tmp_str = xmlNodeListGetString(doc, gchild_node->xmlChildrenNode, 1))) { startDate[i] = (char *) tmp_str; xmlFree(tmp_str); } } else if (!xmlStrcmp(gchild_node->name, (xmlChar*) "endDate")) { if ((tmp_str = xmlNodeListGetString(doc, gchild_node->xmlChildrenNode, 1))) { endDate[i] = (char *) tmp_str; xmlFree(tmp_str); } } else if (!xmlStrcmp(gchild_node->name, (xmlChar*) "instant")) { if ((tmp_str = xmlNodeListGetString(doc, gchild_node->xmlChildrenNode, 1))) { endDate[i] = (char *) tmp_str; xmlFree(tmp_str); } } gchild_node = gchild_node->next; } } child_node = child_node->next; } } xmlXPathFreeObject(context_res); return DataFrame::create(Named("contextId")=contextId, Named("scheme")=scheme, Named("identifier")=identifier, Named("startDate")=startDate, Named("endDate")=endDate, Named("dimension1")=dimension1, Named("value1")=value1, Named("dimension2")=dimension2, Named("value2")=value2, Named("dimension3")=dimension3, Named("value3")=value3, Named("dimension4")=dimension4, Named("value4")=value4); }