/* **************************************************************************** * * deleteIndividual - */ TEST(logTraceTreat, deleteIndividual) { ConnectionInfo ci0("/log/traceLevel/0-255", "PUT", "1.1"); ConnectionInfo ci1("/log/traceLevel/161", "DELETE", "1.1"); ConnectionInfo ci2("/log/traceLevel/aaa", "DELETE", "1.1"); ConnectionInfo ci3("/log/traceLevel", "GET", "1.1"); const char* outfile0 = "orion.logTrace.allLevelsSet.valid.xml"; const char* outfile1 = "orion.logTrace.deleteOk.valid.xml"; const char* outfile2 = "orion.logTrace.invalidDelete.valid.xml"; const char* outfile3 = "orion.logTrace.deleteIndividual4.valid.xml"; std::string out; utInit(); ci0.outFormat = XML; ci0.apiVersion = "v1"; out = restService(&ci0, rs); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile0)) << "Error getting test data from '" << outfile0 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); ci1.outFormat = XML; ci1.apiVersion = "v1"; out = restService(&ci1, rs); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); ci2.outFormat = XML; ci2.apiVersion = "v1"; out = restService(&ci2, rs); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); ci3.outFormat = XML; ci3.apiVersion = "v1"; out = restService(&ci3, rs); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile3)) << "Error getting test data from '" << outfile3 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); utExit(); }
void quadratic_prog(const Vector6d &f, double &lambda, double &miu) { const double a=f[0], b=f[3], c=f[1], d=f[4], e=f[5]; double sum = 0.0; const int N = 2; Matrix<double> G(N, N); G[0][0]=2*a, G[0][1]=b; G[1][0]=b, G[1][1]=2*c; Vector<double> g0(N); g0[0]=d, g0[1]=e; //eq constraints /* Matrix<double> CE(n, m); CE[0][0]=1, CE[1][0]=1; Vector<double> ce0(m); ce0[0]=-3; */ Matrix<double> CE; Vector<double> ce0; //in-eq constraints Matrix<double> CI(N, N); CI[0][0]=1, CI[0][1]=0; CI[1][0]=0, CI[1][1]=1; Vector<double> ci0(N); ci0[0]=0, ci0[1]=-0.001; //=========================== Vector<double> x(N); const double rr = solve_quadprog(G, g0, CE, ce0, CI, ci0, x) + f.z; std::cout << "MinF: " << rr << " x: " << x[0] <<", " <<x[1] << std::endl; lambda = x[0]; miu = x[1]; }
void testpluginPlugin::getCatalog(QList<CatItem>* items) { items = items; CatItem me(itemPath); #ifdef TEST Q_ASSERT(items); CatItem cv("test://catalogTestVerb", testVerbStr, TEST_HASH); cv.setItemType(CatItem::VERB); items->append(cv); CatItem ci("test://catalogTestNounItem", testNounStr , TEST_HASH); CatItem c("testCatalogChildItem", "testChild", TEST_HASH); ci.addChild(c); items->append(ci); for(uint i=0; i < str_len;i++){ QString out_str = str_list[i][1]; CatItem it(out_str, out_str, TEST_HASH); it.setExternalWeight(MAX_EXTERNAL_WEIGHT, me); qDebug() << "test item path: " << it.getPath(); qDebug() << "test item name: " << it.getName(); items->append(it); } QFileInfo fileInfo("~/.oneline/custom_actions/Send_Email.oneline"); Q_ASSERT(fileInfo.exists()); QSettings s(fileInfo.absoluteFilePath(), QSettings::IniFormat); CatItem custI(&s); // CatItem custI("vTestCustomVerb", testCustomVerbStr, TEST_HASH); // custI.setCustomPluginValue(MIN_ARG_NUM_KEY,2); // custI.setCustomPluginInfo(VERB_ARG "1","built-in://long-text | body | %s"); // custI.setCustomPluginInfo(VERB_ARG "2","tag://email-address | recipient(s) | to %s "); // custI.setCustomPluginInfo(VERB_ARG "3","tag://email-address | recipient(s) | to %s "); // custI.setCustomPluginInfo(CUSTOM_ACTION_KEY,"test_action.sh"); #endif #ifdef TEST_GUI Q_ASSERT(items); CatItem ci("catalogTestItem", "testItem", TEST_HASH); ci.setExternalWeight(HIGH_EXTERNAL_WEIGHT,me); ci.addChild(CatItem("testCatalogChildItem", "testChild", TEST_HASH)); items->append(ci); for(uint i=0; i < str_len;i++){ QString out_str = str_list[i][1]; CatItem it(out_str, out_str, TEST_HASH); items->append(it); } CatItem ci0("AHighttestResultItem", "AHighcustom",TEST_HASH); ci0.setExternalWeight(HIGH_EXTERNAL_WEIGHT,me); items->append(ci0); CatItem ci1("AtestResultSource", "Acustom",TEST_HASH); ci1.setItemType(CatItem::TAG); CatItem childI1("AtestResultChild", "nps_child",TEST_HASH); ci1.addChild(childI1); items->append(childI1); items->append(ci1); CatItem ci2("XtestResultSource", "Xcustom",TEST_HASH); ci2.setItemType(CatItem::TAG); CatItem childI2("XtestResultChild", "wmv_child",TEST_HASH); ci2.addChild(childI2); items->append(childI2); items->append(ci2); CatItem ci3("UtestResultSource", "Ucustom",TEST_HASH); ci3.setItemType(CatItem::TAG); CatItem childI3("UtestResultChild", "pst_child",TEST_HASH); ci3.addChild(childI3); items->append(ci3); items->append(childI3); for(uint i=0; i < fill_len;i++){ QString out_str = fill_list[i][1]; CatItem it(out_str, out_str, TEST_HASH); items->append(it); } CatItem it("tag item"); it.setItemType(CatItem::OPERATION); it.setTakesAnykeys(true); for(int i=0; i< 20; i++){ CatItem it(QString::number(i)); ListItem li(it); for(int j=0; j< 30; j++){ CatItem it2(numAsStr(i)); ListItem li2(it2); li.setTotalWeight(abs(5000 - j*j*10 + i*i*i)); li.addChild(li2); if(j % 3 ==0){ tl.append(li2); } } if(i%5 ==0){ tl.append(li); } } #endif }