DispatchStatus demo::MyHello::___testSeq(ServerRequest& __inS) { InputStream& __is = __inS.incoming(); OutputStream& __os = __inS.outgoing(); ::demo::MyStruct cd; cd.__read(__is); Long lvalue; Long __ret = testSeq(cd, lvalue); __inS.initReply (); __os.write_long(lvalue); __os.write_long(__ret); return DispatchOK; }
/** perform a single line test */ void doTest(int x0, int y0, int x1, int y1) { int min_visits = std::min(std::abs(x0 - x1), std::abs(y0 - y1)); cout << "\nTesting line from " << x0 << ", " << y0 << " to " << x1 << ", " << y1 << "...\n"; vector<CoOrd> results; Visitor visitor(results); line(x0, y0, x1, y1, visitor); OutputCoOrd outputter; for_each(results.begin(), results.end(), outputter); TestSequence testSeq(*results.begin()); for_each(results.begin() + 1, results.end(), testSeq); CPPUNIT_ASSERT(results.size() >= min_visits); CPPUNIT_ASSERT(results.front().first == x0 && results.front().second == y0); CPPUNIT_ASSERT(results.back().first == x1 && results.back().second == y1); }
int main(int argc, char *argv[]) { int A[ASIZE]; for (int i=0; i<ASIZE; i++) A[i] = rand()%10000; testSeq(A,ASIZE); return 0; }
int FilterSeqsCommand::execute() { try { if (abort == true) { if (calledHelp) { return 0; } return 2; } ifstream inFASTA; m->openInputFile(fastafileNames[0], inFASTA); Sequence testSeq(inFASTA); alignmentLength = testSeq.getAlignLength(); inFASTA.close(); ////////////create filter///////////////// m->mothurOut("Creating Filter... "); m->mothurOutEndLine(); filter = createFilter(); m->mothurOutEndLine(); m->mothurOutEndLine(); if (m->control_pressed) { outputTypes.clear(); return 0; } ofstream outFilter; //prevent giantic file name map<string, string> variables; variables["[filename]"] = outputDir + filterFileName + "."; if (fastafileNames.size() > 3) { variables["[filename]"] = outputDir + "merge."; } string filterFile = getOutputFileName("filter", variables); m->openOutputFile(filterFile, outFilter); outFilter << filter << endl; outFilter.close(); outputNames.push_back(filterFile); outputTypes["filter"].push_back(filterFile); ////////////run filter///////////////// m->mothurOut("Running Filter... "); m->mothurOutEndLine(); filterSequences(); m->mothurOutEndLine(); m->mothurOutEndLine(); int filteredLength = 0; for(int i=0;i<alignmentLength;i++){ if(filter[i] == '1'){ filteredLength++; } } if (m->control_pressed) { outputTypes.clear(); for(int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; } m->mothurOutEndLine(); m->mothurOut("Length of filtered alignment: " + toString(filteredLength)); m->mothurOutEndLine(); m->mothurOut("Number of columns removed: " + toString((alignmentLength-filteredLength))); m->mothurOutEndLine(); m->mothurOut("Length of the original alignment: " + toString(alignmentLength)); m->mothurOutEndLine(); m->mothurOut("Number of sequences used to construct filter: " + toString(numSeqs)); m->mothurOutEndLine(); //set fasta file as new current fastafile string current = ""; itTypes = outputTypes.find("fasta"); if (itTypes != outputTypes.end()) { if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); } } m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); for(int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); } m->mothurOutEndLine(); return 0; } catch(exception& e) { m->errorOut(e, "FilterSeqsCommand", "execute"); exit(1); } }
sequence_set_t SVS_method(const unique_ptr<DFSM>& fsm, int extraStates) { RETURN_IF_UNREDUCED(fsm, "FSMtesting::SVS_method", sequence_set_t()); if (extraStates < 0) return sequence_set_t(); auto stateCover = getStateCover(fsm); auto traversalSet = getTraversalSet(fsm, extraStates); traversalSet.emplace(sequence_in_t()); auto VSet = getVerifyingSet(fsm); auto SCSets = getStatesCharacterizingSets(fsm, getStatePairsShortestSeparatingSequences, true, reduceSCSet_LS_SL); for (int i = 0; i < SCSets.size(); i++) { if (!VSet[i].empty()) { SCSets[i].clear(); SCSets[i].emplace(move(VSet[i])); } } bool startWithStout = (SCSets[0].begin()->front() == STOUT_INPUT); if (fsm->isOutputState()) { extraStates *= 2; // STOUT_INPUT follows each input in traversalSet } FSMlib::PrefixSet pset; for (const auto& trSeq : stateCover) { for (const auto& extSeq : traversalSet) { sequence_in_t transferSeq(trSeq); transferSeq.insert(transferSeq.end(), extSeq.begin(), extSeq.end()); state_t state = fsm->getEndPathState(0, transferSeq); if (state == WRONG_STATE) continue; for (const auto& SCSet : SCSets) {// i.e. VSet for (const auto& cSeq : SCSet) {// usually only one seq = SVS sequence_in_t testSeq(transferSeq); if (startWithStout) { testSeq.push_front(STOUT_INPUT); testSeq.pop_back();// the last STOUT_INPUT (it will be at the beginning of appended cSeq) } testSeq.insert(testSeq.end(), cSeq.begin(), cSeq.end()); pset.insert(move(testSeq)); } } if (extSeq.size() == extraStates) {// check outcoming transitions //state_t state = getIdx(states, fsm->getEndPathState(0, transferSeq)); for (input_t input = 0; input < fsm->getNumberOfInputs(); input++) { // usually only one seq = SVS is sufficient for transition verification //printf("%d-%d ", fsm->getNextState(state, input), SCSets[fsm->getNextState(state, input)].size()); state_t nextState = fsm->getNextState(state, input); if (nextState == NULL_STATE) continue; for (const auto& cSeq : SCSets[nextState]) { sequence_in_t testSeq(transferSeq); testSeq.push_back(input); if (startWithStout) { testSeq.push_front(STOUT_INPUT); } else if (fsm->isOutputState()) { testSeq.push_back(STOUT_INPUT); } testSeq.insert(testSeq.end(), cSeq.begin(), cSeq.end()); pset.insert(move(testSeq)); } } } } } return pset.getMaximalSequences(); }