diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e0993a..5b6264b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ add_subdirectory( Meta ) add_subdirectory( Proof ) add_subdirectory( Reflection ) add_subdirectory( Testing ) +add_subdirectory( Utility ) # The local subdir tests to build add_subdirectory( AutoRAII.test ) diff --git a/Utility/CMakeLists.txt b/Utility/CMakeLists.txt new file mode 100644 index 0000000..6c94d4f --- /dev/null +++ b/Utility/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( StackableStreambuf.test ) diff --git a/Utility/StackableStreambuf.test/0.cc b/Utility/StackableStreambuf.test/0.cc new file mode 100644 index 0000000..36d1ad7 --- /dev/null +++ b/Utility/StackableStreambuf.test/0.cc @@ -0,0 +1,39 @@ +static_assert( __cplusplus > 2020'00 ); + +#include "../StackableStreambuf.h" + +#include + +#include +#include +#include + +#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" ); + }; +}; diff --git a/Utility/StackableStreambuf.test/CMakeLists.txt b/Utility/StackableStreambuf.test/CMakeLists.txt new file mode 100644 index 0000000..d31c4a6 --- /dev/null +++ b/Utility/StackableStreambuf.test/CMakeLists.txt @@ -0,0 +1,2 @@ +link_libraries( unit-test ) +unit_test( 0 )