1
0
forked from Alepha/Alepha

Tuplize args testing.

The code bit-rotted a bit.  Some internals of Alepha
changed, this impl of tuplize args being imported from a
near-dead laptop.
This commit is contained in:
2023-10-25 04:48:09 -04:00
parent 5908f8d126
commit 89dd3cc81c
4 changed files with 57 additions and 10 deletions

44
tuplize_args.test/0.cc Normal file
View File

@ -0,0 +1,44 @@
#include "../tuplize_args.h"
#include <Alepha/Testing/test.h>
#include <Alepha/Testing/TableTest.h>
#include <Alepha/Utility/evaluation_helpers.h>
static auto init= Alepha::Utility::enroll <=[]
{
using namespace Alepha::Testing::exports;
using namespace Alepha::Utility::exports::evaluation_helpers;
"A basic tuplization example"_test <=TableTest
<
Alepha::tuplizeArgs< std::tuple< int, std::string, int, char > >
>
::Cases
{
{ "Smoke example", { { "1", "Hello", "42", "x" } }, { 1, "Hello", 42, 'x' } },
};
"Do trailing vectors permit variadics?"_test <=TableTest
<
Alepha::tuplizeArgs< std::tuple< int, std::string, std::vector< int > > >
>
::Cases
{
{ "One extra argument", { { "1", "Hello", "2" } }, { 1, "Hello", { 2 } } },
{ "Two extra arguments", { { "1", "Hello", "2", "3" } }, { 1, "Hello", { 2, 3 } } },
{ "Three extra arguments", { { "1", "Hello", "2", "3", "4" } }, { 1, "Hello", { 2, 3, 4 } } },
};
"Does trailing optional stacked permit variadics??"_test <=TableTest
<
Alepha::tuplizeArgs< std::tuple< std::optional< int >, std::optional< std::string >, std::optional< int > > >
>
::Cases
{
{ "No arguments", { {} }, { std::nullopt, std::nullopt, std::nullopt } },
{ "One argument", { { "1" } }, { 1, std::nullopt, std::nullopt } },
{ "Two arguments", { { "1", "Hello" } }, { 1, "Hello", std::nullopt } },
{ "Three arguments", { { "1", "Hello", "2" } }, { 1, "Hello", 2 } },
};
};

View File

@ -0,0 +1 @@
unit_test( 0 )