int main(int argc, char *argv[]) { ramfuzz::runtime::gen g(argc, argv); ramfuzz::harness<ns1::B> rb1(g); for (auto m : rb1.mroulette) (rb1.*m)(); return (rb1.obj->get() != 5); }
main(int argc, char *argv[]) { node gnd; node n1("n1"); node n2("n2"); node n3("n3"); node n4("n4"); node n5("n5"); node n6("n6"); vdc vcc("vcc", n6, gnd, 5.0); vpulse vin("vin", n1, gnd, 0, 5, 2e-9, 2e-9, 2e-9, 10e-9); r rb1("rb1", n1, n2, 10e3); r rc1("rc1", n6, n3, 1e3); qnd q1("q1", n3, n2, gnd); r rb2("rb2", n3, n4, 10e3); qnd q2("q2", n5, n4, gnd); r rc2("rc2", n6, n5, 1e3); op::monitor = 1; op(); plot::output = *argv; plot::add("n1", "n3", "n5"); tran::tsmin = 1.0e-30; tran::monitor = 1; tran(0.2e-9, 20.0e-9); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { device = new usb_debug(0x0483, 0x5711); device->autoPlug(true); timer = new QTimer(this); timer1 = new QTimer(this); timer2 = new QTimer(this); ui->setupUi(this); setCentralWidget(ui->groupBox_2); ui->statusBar->hide(); QString lb = QString("vid - %1, pid - %2").arg(device->hidHardwire.vid, 0, 16).arg(device->hidHardwire.pid, 0, 16); ui->label->setText(lb); //ui->label_2->setStyleSheet("qproperty-alignment: 'AlignCenter | AlignCenter';"); ui->label_2->clear(); ui->radioButton_1->setChecked(true); ui->groupBox_3->setEnabled(false); ui->openDev->setEnabled(false); ui->closeDev->setEnabled(false); ui->label_3->setFixedSize(20,20); ui->label_3->setStyleSheet( "border-radius: 10px; background-color: black;" ); ui->label_4->setFixedSize(20,20); ui->label_4->setStyleSheet( "border-radius: 10px; background-color: black;" ); connect(ui->enumerate, SIGNAL(clicked()), &device->hidHardwire, SLOT(enumerate())); connect(&device->hidHardwire, SIGNAL(valueChanged(const QString&)), ui->textBrowser, SLOT(append(const QString&))); connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(close())); connect(ui->openDev, SIGNAL(clicked()), this, SLOT(autoPlugOn())); connect(ui->closeDev, SIGNAL(clicked()), this, SLOT(autoPlugOff())); connect(&device->hidHardwire, SIGNAL(devConnected()), this, SLOT(devOpenRoutine())); connect(&device->hidHardwire, SIGNAL(devDisconnect()), this, SLOT(devOpenRoutine())); connect(ui->radioButton_1, SIGNAL(clicked()), this, SLOT(rb1())); connect(ui->radioButton_2, SIGNAL(clicked()), this, SLOT(rb2())); connect(ui->send_to_, SIGNAL(clicked()),this, SLOT(send_to_dev())); connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(get_from_dev())); connect(ui->readFromDev, SIGNAL(clicked()), device, SLOT(onPullingExtBuffer())); connect(device, SIGNAL(inputBufferUPD()),this, SLOT(get_from_dev())); connect(device, SIGNAL(debug()), this, SLOT(debug())); }
// load unregistered polymorphic classes void load_unregistered1(const char *testfile) { std::ifstream is(testfile); boost::archive::iarchive ia(is); polymorphic_base *rb1(NULL); // registration IS necessary when serializing a polymorphic class // through pointer to the base class bool except = false; BOOST_TRY { ia >> BOOST_SERIALIZATION_NVP(rb1); } BOOST_CATCH(boost::archive::archive_exception aex){ except = true; BOOST_CHECK_MESSAGE( NULL == rb1, "failed load resulted in a non-null pointer" ); }
int main() { RingBuffer<unsigned, ReadErrorPolicyDefaultValue<unsigned>, WriteErrorPolicyOverwrite> rb1(SIZE); //Create object with copy constructor RingBuffer<unsigned, ReadErrorPolicyDefaultValue<unsigned>, WriteErrorPolicyOverwrite> rb2(rb1); RingBuffer<unsigned, ReadErrorPolicyException<unsigned>, WriteErrorPolicyException> rb3(SIZE); RingBuffer<unsigned, ReadErrorPolicyException<unsigned>, WriteErrorPolicyIgnore> rb4(SIZE); //test if copy constructor works right assert( &rb1 != &rb2); //Test DefaultValue Policy on reading an empty RingBuffer assert( rb1.read( ) == 0); //Test Exception Policy on reading an empty RingBuffer try { rb3.read(); } catch (exception& e) { //cout << e.what() << endl; } for (int i = 0; i < SIZE; i++) { rb1.write(i); rb3.write(i); rb4.write(i); } //Test Overwrite Policy on full Ring Buffer rb1.write(SIZE); assert( rb1.getSize() == SIZE); //Test Exception Policy on full Ring Buffer try { rb4.write(SIZE); } catch (exception& e) { //cout << e.what() << endl; } for (int i = 0; i < SIZE; i++) { assert(rb1.read() == i+1); assert(rb3.read() == i); assert(rb4.read() == i); } //Test DefaultValue Policy on reading an empty RingBuffer assert( rb1.read() == 0); //Test Exception Policy on reading an empty RingBuffer try { rb3.read(); } catch (exception& e) { //cout << e.what() << endl; } cout << "Tests finished" << endl; return 0; }