adds AXI4 pin level test and moves all tests to automatic discovery

This commit is contained in:
2022-10-03 11:08:39 +02:00
parent b68b8c3045
commit e0c3e3d898
6 changed files with 62 additions and 31 deletions

View File

@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.12)
add_executable (io_redirector
main.cpp
)
target_link_libraries (io_redirector LINK_PUBLIC scc)
project (io_redirector)
add_executable (${PROJECT_NAME} test.cpp)
target_link_libraries (io_redirector LINK_PUBLIC scc-util Catch2::Catch2)
add_test(NAME io_redirector_test COMMAND io_redirector)
#add_test(NAME io_redirector_test COMMAND io_redirector)
catch_discover_tests(${PROJECT_NAME})

View File

@ -1,22 +1,17 @@
/*
* main.cpp
*
* Created on: 01.01.2019
* Author: eyck
*/
#define CATCH_CONFIG_MAIN
#include <catch2/catch_all.hpp>
#include <util/io-redirector.h>
#include <iostream>
#include <cstdio>
#include <cassert>
int main(int arcg, char* argv[]){
TEST_CASE( "io-redirector", "[io-redirector]" ) {
util::IoRedirector::get().start();
auto result1 = util::IoRedirector::get().get_output();
assert(result1=="");
printf("Some output");
std::cout<<"Some other output"<<std::endl;
auto result2 = util::IoRedirector::get().get_output();
assert(result2=="Some outputSome other output\n");
util::IoRedirector::get().stop();
REQUIRE( result1=="" );
REQUIRE( result2=="Some outputSome other output\n" );
}