int main(int argc, char* argv[]) { //Ejemplo de alineamiento ficticio //Ojo, no se está calculando nada en este ejemplo Sequence seq1("seq_a_1", "GTACTCATAAAA"); Sequence seq2("seq_b_1", "GACTCAGTAACA"); //Sequence seq1("seq_a_1", "GTACTCA T"); //Sequence seq2("seq_b_1", "G ACTCAGT"); Alignment alignment(seq1, seq2, "GTACTCA-TAAAA", "G-ACTCAGTAACA", 0, 0, 10, 10, 26); alignment.print(); return 0; }
void checkQKeySequence() { // Check that the valid keycode Qt::Key_unknown is handled gracefully // // Qt::Key_unknown is a valid Qt Key. But toString makes unicode gibberish // from it. '???'. // Reported with patch - mjansen QKeySequence unknown_key(Qt::Key_unknown); // The keycode falls into the unicode handling QString p = QChar((Qt::Key_unknown-0x10000)/0x400+0xd800); p += QChar((Qt::Key_unknown-0x10000)%400+0xdc00); QCOMPARE(unknown_key.toString(), p); // What happens QEXPECT_FAIL("", "Qt::Key_unknown not handled", Continue); QCOMPARE(unknown_key.toString(), QString()); // What i would expect // Check that the keycode -1 is handled gracefully. // // -1 happens for some keys when listening to keyPressEvent in QWidget::event() // It means the key is not supported by Qt. It probably should be // Qt::Key_unknown instead. Unsupported keys: (Alt+Print for example). // Reported with patch - mjansen QKeySequence invalid_key(-1); // The keycode falls into the handling of keys lesser that Key_escape QString p1 = QChar((-1) & 0xffff).toUpper(); QCOMPARE(invalid_key.toString(), QString("Meta+Ctrl+Alt+Shift+"+p1)); // What happens QEXPECT_FAIL("", "-1 not handled", Continue); QCOMPARE(invalid_key.toString(), QString()); // What i would expect // The famous "KDE4 eats my E key" bug: Win+E isn't parsed anymore. QKeySequence seq("Win+E"); QEXPECT_FAIL("", "Qt Bug 205255/134941 - QKeySequence silently discards unknown key modifiers", Continue); QVERIFY(seq.isEmpty()); // And what really happens QCOMPARE(seq.toString(), QLatin1String("E")); // KDE3 -> KDE4 migration. KDE3 used xKeycodeToKeysym or something and // stored the result QKeySequence seq2("Meta+Alt+Period"); QEXPECT_FAIL("", "Qt Bug 205255/134941 - QKeySequence silently discards unknown key modifiers", Continue); QVERIFY(seq2.isEmpty()); // And what really happens QCOMPARE(seq2.toString(), QLatin1String("Meta+Alt+")); }
int main() { const int SIZE = 20; // Make a vector of SIZE integers std::vector<int> seq(SIZE); // Populate the vector with 0, 1, 2, 3, ..., SIZE - 1 std::iota(std::begin(seq), std::end(seq), 0); // Display the vector std::for_each(std::begin(seq), std::end(seq), [](int x) { std::cout << x << ' '; }); std::cout << '\n'; // Make a vector large enough to hold the copied values std::vector<int> seq2(SIZE); // Copy the seq to seq2 std::copy(std::begin(seq), std::end(seq), std::begin(seq2)); // Display seq2 std::for_each(std::begin(seq2), std::end(seq2), [](int x) { std::cout << x << ' '; }); std::cout << '\n'; // Make a vector large enough to hold the transformed values std::vector<int> seq3(SIZE); // Copy the seq to seq3 std::transform(std::begin(seq), std::end(seq), std::begin(seq3), [](int n) { return 2*n; }); // Display seq3 std::for_each(std::begin(seq3), std::end(seq3), [](int x) { std::cout << x << ' '; }); std::cout << '\n'; }
void perform_test_trivial() { { typedef int value_type; typedef std::set<value_type> set_type; typedef std::set<set_type> container_type; typedef container_type::iterator container_iterator; typedef Subsumption_elimination<container_type> elimination_type; elimination_type sub_elim; { // empty sequence container_type empty; sub_elim.upward(empty, empty.begin(), empty.end()); OKLIB_TEST_EQUAL_RANGES(empty, container_type()); sub_elim(empty); OKLIB_TEST_EQUAL_RANGES(empty, container_type()); } { // example sequence container_type seq; seq.insert(boost::assign::list_of(1) (2)); const container_iterator first_subsumption = seq.insert(boost::assign::list_of(1) (2) (3)).first; container_iterator second_subsumption = seq.insert(boost::assign::list_of(2) (3) (4)).first; seq.insert(boost::assign::list_of(3) (4)); const container_type orig(seq); seq.erase(first_subsumption); { container_type seq2(orig); sub_elim.upward(seq2, seq2.begin(), seq2.end()); OKLIB_TEST_EQUAL_W2(seq2, seq); seq.erase(second_subsumption); sub_elim.upward(seq2, seq2.rbegin(), seq2.rend()); OKLIB_TEST_EQUAL_W2(seq2, seq); } { container_type seq2(orig); sub_elim(seq2); OKLIB_TEST_EQUAL_W2(seq2, seq); } { typedef std::list<set_type> container_type; container_type seq2(orig.begin(), orig.end()); typedef Subsumption_elimination<container_type> elimination_type; elimination_type sub_elim; sub_elim(seq2); OKLIB_TEST_EQUAL_RANGES(seq2, seq); } { typedef std::list<set_type> container_type; container_type seq2(orig.begin(), orig.end()); seq2.insert(seq2.end(), orig.begin(), orig.end()); seq2.sort(OKlib::Programming::Utilities::OrderRelations::SizeLessThan<std::less<set_type> >()); seq2.erase(std::unique(seq2.begin(), seq2.end()), seq2.end()); typedef Subsumption_elimination<container_type, SubsumptionsTags::hyperedges_are_unique, SubsumptionsTags::hyperedges_sorted_by_size> elimination_type; elimination_type sub_elim; sub_elim(seq2); OKLIB_TEST_EQUAL_RANGES(seq2, seq); } } } }