SystemC-Components-Test/tests/io-redirector/test.cpp

18 lines
537 B
C++
Raw Normal View History

#define CATCH_CONFIG_MAIN
#include <catch2/catch_all.hpp>
2020-04-23 16:02:12 +02:00
#include <util/io-redirector.h>
#include <iostream>
#include <cstdio>
TEST_CASE( "io-redirector", "[io-redirector]" ) {
2022-09-30 15:21:01 +02:00
util::IoRedirector::get().start();
auto result1 = util::IoRedirector::get().get_output();
2020-04-23 16:02:12 +02:00
printf("Some output");
std::cout<<"Some other output"<<std::endl;
2022-09-30 15:21:01 +02:00
auto result2 = util::IoRedirector::get().get_output();
util::IoRedirector::get().stop();
REQUIRE( result1=="" );
REQUIRE( result2=="Some outputSome other output\n" );
2020-04-23 16:02:12 +02:00
}