Implement more sophisticated readline-mode
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "drivertests.hpp"
|
||||
#include "drivenengine.hpp"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
static void write_closed_message(Channel *ch, StreamBuffer *out) {
|
||||
@@ -107,17 +106,23 @@ public:
|
||||
// This test just prints the time.
|
||||
class DriverPrintClockTest : public DrivenEngine {
|
||||
public:
|
||||
int count;
|
||||
int count_;
|
||||
double last_clock_;
|
||||
virtual void event_init(int argc, char *argv[]) {
|
||||
count = 0;
|
||||
count_ = 0;
|
||||
last_clock_ = 0.0;
|
||||
}
|
||||
|
||||
virtual void event_update() {
|
||||
std::cerr << std::fixed << std::setprecision(2) << get_clock() << " ";
|
||||
count++;
|
||||
if (count == 10) {
|
||||
std::cerr << std::endl;
|
||||
count = 0;
|
||||
double clock = get_clock();
|
||||
if (clock > last_clock_ + 0.5) {
|
||||
stdostream() << std::fixed << std::setprecision(2) << clock << " ";
|
||||
count_++;
|
||||
last_clock_ = clock;
|
||||
}
|
||||
if (count_ == 10) {
|
||||
stdostream() << std::endl;
|
||||
count_ = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user