forked from Alepha/Alepha
Stackable streambuf testing...
This commit is contained in:
1
Utility/CMakeLists.txt
Normal file
1
Utility/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory( StackableStreambuf.test )
|
39
Utility/StackableStreambuf.test/0.cc
Normal file
39
Utility/StackableStreambuf.test/0.cc
Normal file
@ -0,0 +1,39 @@
|
||||
static_assert( __cplusplus > 2020'00 );
|
||||
|
||||
#include "../StackableStreambuf.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <Alepha/Testing/test.h>
|
||||
#include <Alepha/Testing/TableTest.h>
|
||||
#include <Alepha/Utility/evaluation.h>
|
||||
|
||||
#include "../word_wrap.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace Alepha::Testing::literals::test_literals;;
|
||||
using Alepha::Testing::TableTest;
|
||||
}
|
||||
|
||||
static auto init= Alepha::Utility::enroll <=[]
|
||||
{
|
||||
"Simple stacked wordwrap case."_test <=[]
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
oss << Alepha::StartWrap{ 20 };
|
||||
oss << "First wrapping\n";
|
||||
oss << Alepha::StartWrap{ 10 };
|
||||
oss << "Second wrapping\n";
|
||||
oss << Alepha::EndWrap;
|
||||
oss << "Third wrapping more than 20\n";
|
||||
oss << Alepha::EndWrap;
|
||||
|
||||
std::ofstream log{ "log.txt" };
|
||||
log << oss.str();
|
||||
log.close();
|
||||
std::cout << oss.str() << std::flush;
|
||||
assert( oss.str() == "First wrapping\nSecond \nwrapping\nThird wrapping more \nthan 20\n" );
|
||||
};
|
||||
};
|
2
Utility/StackableStreambuf.test/CMakeLists.txt
Normal file
2
Utility/StackableStreambuf.test/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
link_libraries( unit-test )
|
||||
unit_test( 0 )
|
Reference in New Issue
Block a user