test/test_streamaligner.cpp
/**
 * This test case check weather the aligner waits
 * the full timeout again after he replayed a sample
 * from a stream
 * */
This test case check weather the aligner waits
the full timeout again after he replayed a sample
from a stream
This test case check weather the aligner waits the full timeout again after he replayed a sample from a stream
BOOST_AUTO_TEST_CASE(advanced_timeout)
{
    std::cout<<"\n*** STREAM_ALIGNER [TEST 12] ***\n";
    StreamAligner<NUMBER_OF_STREAMS> aligner;
    aligner.setTimeout(base::Time::fromSeconds(2.0));
    const size_t N = 5;
    int s1 = aligner.registerStream<std::string, N>(&test_callback, base::Time::fromSeconds(1,0));
    aligner.registerStream<std::string, N>(&test_callback, base::Time::fromSeconds(0,0));
    aligner.push<std::string, N>(s1, base::Time::fromSeconds(1.0), std::string("a"));
    aligner.push<std::string, N>(s1, base::Time::fromSeconds(1.1), std::string("b"));
    last_sample = ""; aligner.step(); BOOST_CHECK(last_sample == "");
    aligner.push<std::string, N>(s1, base::Time::fromSeconds(3.1),std::string("c"));
    last_sample = ""; aligner.step(); BOOST_CHECK(last_sample == "a");
    last_sample = ""; aligner.step(); BOOST_CHECK(last_sample == "b");
    last_sample = ""; aligner.step(); BOOST_CHECK(last_sample == "c");
    aligner.push<std::string, N>(s1, base::Time::fromSeconds(4.2), std::string("d"));
    last_sample = ""; aligner.step(); BOOST_CHECK(last_sample == "");
}
BOOST_AUTO_TEST_CASE ( advanced_timeout ) { std :: cout << " \n \n " ; StreamAligner < NUMBER_OF_STREAMS > aligner ; aligner . setTimeout ( base :: Time :: fromSeconds ( 2.0 ) ) ; const size_t N = 5 ; int s1 = aligner . registerStream < std :: string , N > ( & test_callback , base :: Time :: fromSeconds ( 1 , 0 ) ) ; aligner . registerStream < std :: string , N > ( & test_callback , base :: Time :: fromSeconds ( 0 , 0 ) ) ; aligner . push < std :: string , N > ( s1 , base :: Time :: fromSeconds ( 1.0 ) , std :: string ( " " ) ) ; aligner . push < std :: string , N > ( s1 , base :: Time :: fromSeconds ( 1.1 ) , std :: string ( " " ) ) ; last_sample = " " ; aligner . step ( ) ; BOOST_CHECK ( last_sample == " " ) ; aligner . push < std :: string , N > ( s1 , base :: Time :: fromSeconds ( 3.1 ) , std :: string ( " " ) ) ; last_sample = " " ; aligner . step ( ) ; BOOST_CHECK ( last_sample == " " ) ; last_sample = " " ; aligner . step ( ) ; BOOST_CHECK ( last_sample == " " ) ; last_sample = " " ; aligner . step ( ) ; BOOST_CHECK ( last_sample == " " ) ; aligner . push < std :: string , N > ( s1 , base :: Time :: fromSeconds ( 4.2 ) , std :: string ( " " ) ) ; last_sample = " " ; aligner . step ( ) ; BOOST_CHECK ( last_sample == " " ) ; }
This test case check weather the aligner waits
 the full timeout again after he replayed a sample
 from a stream
This test case check weather the aligner waits the full timeout again after he replayed a sample from a stream
/** callback, period_time **/ /** bigger than period, bus smaller than timeout, do not replay **/