Commit 257ba6f7 authored by Leander Schulten's avatar Leander Schulten
Browse files

Update the test to fit the new LoopProgram API

parent 5143e53a
#include "testloopprogramm.h"
#include <qdebug.h>
#include <chrono>
#include "programms/boostloopprogramcontextswitcher.h"
namespace Test {
void test(){
void testLoopProgramm(){
auto cs = std::make_unique<Modules::BoostLoopProgramContextSwitcher>();
TestLoopProgramm p;
p.setContextSwitcher(std::move(cs));
p.setOutputLength(10000);
p.start();
auto t1 = std::chrono::high_resolution_clock::now();
while (!p.doStep(2).finished) {
//qDebug() << "wait";
}
auto tdiff = std::chrono::high_resolution_clock::now()-t1;
qDebug()<<(tdiff).count() <<"finished5\n";
qDebug()<<(std::chrono::duration_cast<std::chrono::milliseconds>(tdiff)).count() <<" finished\n";
}
}
#ifndef TESTLOOPPROGRAMM_H
#define TESTLOOPPROGRAMM_H
#include "programms/loopprogramm.h"
#include "programms/program.hpp"
#include <programms/types.h>
#include <programms/program.hpp>
#include <programms/loopprogram.hpp>
#include <iostream>
#include <qdebug.h>
void test();
class TestLoopProgramm : public Modules::LoopProgramm<Modules::TypedProgram<Modules::brightness_t>>
namespace Test{
void testLoopProgramm();
class TestLoopProgramm : public Modules::TypedLoopProgram< Modules::brightness_t >
{
protected:
virtual void loopProgramm()override{
virtual void loopProgram()override{
for(unsigned i = 0; i< outputLength;++i){
output[i] = 255;
//qDebug()<<i;
wait(50);
}
}
......@@ -25,5 +29,6 @@ public:
virtual void start() override{}
virtual ~TestLoopProgramm()override = default ;
};
}
#endif // TESTLOOPPROGRAMM_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment