forked from Alepha/Alepha
Add console colour support.
This commit is contained in:
@ -6,9 +6,12 @@ static_assert( __cplusplus > 201700, "C++17 Required" );
|
||||
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <Alepha/Meta/is_vector.h>
|
||||
#include <Alepha/Utility/evaluation.h>
|
||||
#include <Alepha/console.h>
|
||||
|
||||
namespace Alepha::Hydrogen::Testing
|
||||
{
|
||||
@ -46,10 +49,10 @@ namespace Alepha::Hydrogen::Testing
|
||||
{
|
||||
if( std::apply( function, params ) != expected )
|
||||
{
|
||||
std::cout << " FAILURE: " << comment << std::endl;
|
||||
std::cout << C::red << " FAILURE" << C::normal << ": " << comment << std::endl;
|
||||
++failureCount;
|
||||
}
|
||||
else std::cout << " SUCCESS: " << comment << std::endl;
|
||||
else std::cout << C::green << " SUCCESS" << C::normal << ": " << comment << std::endl;
|
||||
}
|
||||
|
||||
return failureCount;
|
||||
|
@ -13,6 +13,8 @@ static_assert( __cplusplus > 201700, "C++17 Required" );
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <Alepha/console.h>
|
||||
|
||||
namespace Alepha::Hydrogen::Testing
|
||||
{
|
||||
inline namespace exports { inline namespace testing {} }
|
||||
@ -23,14 +25,6 @@ namespace Alepha::Hydrogen::Testing
|
||||
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
namespace C
|
||||
{
|
||||
const std::string csi= "\e[";
|
||||
const std::string green= C::csi + "32m";
|
||||
const std::string red= C::csi + "31m";
|
||||
const std::string normal= C::csi + "0m";
|
||||
}
|
||||
|
||||
struct TestName
|
||||
{
|
||||
std::string name;
|
||||
|
35
console.h
Normal file
35
console.h
Normal file
@ -0,0 +1,35 @@
|
||||
static_assert( __cplusplus > 201700, "C++17 Required" );
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Alepha/Alepha.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Alepha::Hydrogen
|
||||
{
|
||||
inline namespace exports { inline namespace console {} }
|
||||
|
||||
namespace detail::console
|
||||
{
|
||||
inline namespace exports {}
|
||||
|
||||
namespace C
|
||||
{
|
||||
const std::string csi= "\e[";
|
||||
const std::string green= C::csi + "32m";
|
||||
const std::string red= C::csi + "31m";
|
||||
const std::string normal= C::csi + "0m";
|
||||
}
|
||||
|
||||
namespace exports
|
||||
{
|
||||
namespace C= detail::console::C;
|
||||
}
|
||||
}
|
||||
|
||||
namespace exports::console
|
||||
{
|
||||
using namespace detail::console::exports;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user