1
0
forked from Alepha/Alepha

Stackable streambuf testing...

This commit is contained in:
2023-10-20 03:17:57 -04:00
parent f61710bfdb
commit 267e6b4b70
4 changed files with 43 additions and 0 deletions

1
Utility/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory( StackableStreambuf.test )

View 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" );
};
};

View File

@ -0,0 +1,2 @@
link_libraries( unit-test )
unit_test( 0 )