forked from Alepha/Alepha
68 lines
1.4 KiB
C++
68 lines
1.4 KiB
C++
static_assert( __cplusplus > 2020'99 );
|
|
|
|
#include "../delimited_list.h"
|
|
|
|
#include <Alepha/Testing/test.h>
|
|
#include <Alepha/Testing/TableTest.h>
|
|
|
|
#include <Alepha/Utility/evaluation_helpers.h>
|
|
|
|
#include <Alepha/IOStreams/delimiters.h>
|
|
|
|
static auto init= Alepha::Utility::enroll <=[]
|
|
{
|
|
using namespace Alepha::Testing::literals;
|
|
using namespace std::literals::string_literals;
|
|
|
|
using namespace Alepha::Testing::exports;
|
|
|
|
"Simple Comma Testing"_test <=TableTest
|
|
<
|
|
[]( std::vector< std::string > names )
|
|
{
|
|
std::ostringstream oss;
|
|
auto delim= adaptStream( Alepha::StartDelimitedList{ ", "s }, oss );
|
|
|
|
for( const auto &name: names )
|
|
{
|
|
oss << Alepha::NextItem << name;
|
|
}
|
|
|
|
return oss.str();
|
|
}
|
|
>
|
|
::Cases
|
|
{
|
|
{ "Simple", { { "Alpha", "Bravo", "Charlie", "Delta", "Echo" } }, "Alpha, Bravo, Charlie, Delta, Echo" },
|
|
};
|
|
|
|
"Simple Comma Testing using delim function"_test <=TableTest
|
|
<
|
|
[]( std::vector< std::string > names )
|
|
{
|
|
std::ostringstream oss;
|
|
oss << setDelimiter( Alepha::IOStreams::fieldDelimiter, ", " );
|
|
|
|
auto delim= adaptStream( Alepha::StartDelimitedList
|
|
{
|
|
[]( std::ostream &os )
|
|
{
|
|
os << Alepha::IOStreams::fieldDelimiter;
|
|
}
|
|
},
|
|
oss );
|
|
|
|
for( const auto &name: names )
|
|
{
|
|
oss << Alepha::NextItem << name;
|
|
}
|
|
|
|
return oss.str();
|
|
}
|
|
>
|
|
::Cases
|
|
{
|
|
{ "Simple", { { "Alpha", "Bravo", "Charlie", "Delta", "Echo" } }, "Alpha, Bravo, Charlie, Delta, Echo" },
|
|
};
|
|
};
|