void testsuite_loadNext() { if(initialized==0) init(); if(testNumber<TESTCOUNT) loadTest(testNumber++); //memWriteByte(0x200, 18); //memWriteByte(0x201, 82); }
bool TestingWidgetFacade::connectToTestingWidget(QObject* testingwidget) { if(!QObject::connect(testingwidget, SIGNAL(menuJumpRequest()), this, SLOT(switchToStartWidget()), Qt::AutoConnection)) { return 0; } if(!QObject::connect(testingwidget, SIGNAL(startTestRequest()), this, SLOT(startTest()), Qt::AutoConnection)) { return 0; } if(!QObject::connect(testingwidget, SIGNAL(finishTestRequest()), this, SLOT(finishTest()), Qt::AutoConnection)) { return 0; } if(!QObject::connect(testingwidget, SIGNAL(jumpToTaskRequest(QString)), this, SLOT(displayTaskById(QString)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(testingwidget, SIGNAL(jumpToTaskHelp(QString)), this, SLOT(displayHelpById(QString)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(testingwidget, SIGNAL(setTestRequest(ExamsTest)), this, SLOT(setTest(ExamsTest)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(testingwidget, SIGNAL(answers(QList< QPair<QString, QString> >)), this, SLOT(calculateResults(QList<QPair<QString,QString> >)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(testingwidget, SIGNAL(loadTestRequest(QString)), this, SLOT(loadTest(QString)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(this, SIGNAL(timeLabelUpdate(QString)), testingwidget, SLOT(setTimeLabel(QString)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(this, SIGNAL(setTaskCount(int, int, int)), testingwidget, SLOT(setTaskCount(int, int, int)), Qt::AutoConnection)) { return 0; } return 1; }
QDomDocument makeDOM1(const QString& tag, const QString& val, bool orphan = false) { QDomDocument loadTest("scalardocument"); QDomElement scalardoc, child; QDomText text; scalardoc = loadTest.createElement("scalar"); child = loadTest.createElement("tag"); text = loadTest.createTextNode(tag); child.appendChild(text); scalardoc.appendChild(child); child = loadTest.createElement("value"); text = loadTest.createTextNode(val); child.appendChild(text); scalardoc.appendChild(child); if (orphan) { child = loadTest.createElement("orphan"); scalardoc.appendChild(child); } loadTest.appendChild(scalardoc); return loadTest; }
void MainWindow::readIncomingData() { QDataStream in(tcpSocket); in.setVersion(QDataStream::Qt_4_2); if (client_number == 0) { if (tcpSocket->bytesAvailable() < (int)sizeof(quint32)) return; in >> client_number; } if (num_entries == 0) { if (tcpSocket->bytesAvailable() < (int)sizeof(quint64)) return; in >> num_entries; progress_dialog->setMaximum(num_entries); } if (blocksize == 0) { if (tcpSocket->bytesAvailable() < (int)sizeof(quint64)) return; in >> blocksize; } if ((quint64)tcpSocket->bytesAvailable() < blocksize) return; if (!test_loaded) { current_entry++; progress_dialog->setValue(current_entry); } QString received_string; QString buffer; do { in >> buffer; received_string.append(buffer); } while (!in.atEnd()); blocksize = 0; if (!test_loaded) { received_data.append(received_string); if (current_entry >= num_entries) { loadTest(received_data); test_loaded = true; } else { QByteArray ba; QDataStream out(&ba, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_2); out << current_entry; tcpSocket->write(ba); } } else { readResults(received_string); } }
/** MeshObjLoader::load() * For a given meshes check that imported data are correct */ TEST_F(MeshObjLoader_test, LoadCall) { //Check loader high level result EXPECT_FALSE(this->load()); this->setFilename(sofa::helper::system::DataRepository.getFile("mesh/square.obj")); EXPECT_TRUE(this->load()); //Use several meshes to test : edges, triangles, quads, normals, materials NUMBER loadTest("mesh/square.obj", 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0); loadTest("mesh/dragon.obj", 1190, 0, 2564, 0, 0, 0, 0, 0, 0, 0, 0); loadTest("mesh/box.obj", 4, 0, 4, 0, 0, 0, 0, 4, 2, 0, 0); loadTest("mesh/cube.obj", 8, 0, 12, 0, 0, 0, 0, 8, 8, 0, 0); loadTest("mesh/caducee_base.obj", 3576, 0, 420, 3350, 0, 0, 0, 0, 0, 0, 8); loadTest("mesh/torus.obj", 800, 0, 1600, 0, 0, 0, 0, 0, 0, 861, 0); }
int main(int argc, char* argv[]){ cout << "========== TESTING IO Functionality ===========" << endl; loadTest(); }
void CodeEditor::doCommand(uint32 cmd) { switch (cmd) { case CmdPrintFoo: { std::cerr << "Foo\n"; } break; case CmdSave: { save(); } break; case CmdReloadOpenDocument: { reload(); } break; case CmdLoadTest: { loadTest(); } break; case CmdMoveUpToBlank: { moveCursorUpToBlank(); } break; case CmdMoveDownToBlank: { moveCursorDownToBlank(); } break; case CmdMoveToDocumentBegin: { moveCursorToDocumentBegin(); } break; case CmdMoveToDocumentEnd: { moveCursorToDocumentEnd(); } break; case CmdMoveToLineBegin: { moveCursorToLineBegin(); } break; case CmdMoveToLineEnd: { moveCursorToLineEnd(); } break; case CmdSetMark: { setMark(); } break; case CmdSwapCursorAndMark: { swapCursorAndMark(); } break; case CmdMoveCursorToMark: { moveCursorToMark(); } break; case CmdToggleMarkVisibility: { toggleMarkVisibility(); } break; case CmdBackspace: { doBackspace(); } break; case CmdDelete: { doDelete(); } break; case CmdClearLine: { clearLine(mCurrentLine); } break; case CmdClearDocument: { clear(); } break; case CmdTab: { doTab(); } break; case CmdNewline: { addLine(); } break; case CmdOpenConfig: { loadConfig(); } break; case CmdOpenTheme: { loadCurrentTheme(); } break; case CmdLoadHelp: { loadReadMe(); } break; } }
int main() { BEGIN messager("loading training data, test data....", MEKEY); loadTrain(trainData, l_low, l_up); loadTest(testData); messager("done loading", MEKEY); END //initialize alpha values : //separate initialize the alpha values, //norAlpha and attAlhpa all 1 messager("initialize optimized index table", MEKEY); messager("initialize all alpha to 0", MEKEY); messager("initialize all gradient to 0", MEKEY); messager("initialize all gradient bar to 0", MEKEY); BEGIN for (int i = 0; i < train_num; i++) { b.push_back(init_p); alpha.push_back(0.0); optimied_index[i] = false; if (encounter[i] == 1) { penalty.push_back(nor_penalty); pro.push_back(57378/62367); } else { penalty.push_back(att_penalty); pro.push_back(4989/62367); } grad.push_back(b[i]); } for (int i = 0; i < train_num; i++) { grad_bar.push_back(0); //no alpha is C at first, so all for zero } for(int i = 0; i < train_num; i++) { if(!is_lowerBound(i)) { vector<double> column_i = get_Q(i); for(int j = 0; j < train_num; j++) { grad[j] += alpha[i] * column_i[j]; } if(is_upperBound(i)) { for(int j = 0; j < train_num; j++) { grad_bar[j] += penalty[i] * column_i[j]; } } } } END /* * iterator procedure */ //Values newAlpha; messager("modeling...", MEKEY); bool examALL = false; Values violating_pair; int iter = 0; while ( iter < train_num) { //test select WSS1, fixed l_up but not calculate all of it, it's too expense //test_ktt(); cout << iter << endl; int i; int j; vector<double> qColu_i; vector<double> qColu_j; // if(iter%1000 == 0) // { // do_shrinking(); // } if(selectWSS(i, j, violating_pair)) { updateGrad(); active_size = train_num; cout << "finished optimized" << endl; break; } else { qColu_i = get_Q(i); qColu_j = get_Q(j); update_alpha(violating_pair, i, j, qColu_i, qColu_j); updateGrad(); } iter++; } int count = 0; for(int i = 0; i < alpha.size(); i ++) { if(alpha[i] != 0) { cout << "not zero alpha " << alpha[i] << "grad : " << grad[i] << endl; } } messager("alpha not zero", count, MEKEY); return 0; }