1
0
forked from Alepha/Alepha
Files

36 lines
1.6 KiB
C++

static_assert( __cplusplus > 2020'99 );
#include "../string_distance.h"
#include <Alepha/Testing/TableTest.h>
#include <Alepha/Testing/test.h>
static auto init= Alepha::Utility::enroll <=[]
{
using namespace Alepha::Testing::exports;
using namespace Alepha::Algorithm::exports::string_distance_m;
"Rewrite string distance examples."_test <=TableTest< rewriteStringDistance >::Cases
{
{ "Simple example of equality"_case, { "Hello World", "Hello World" }, 0 },
{ "Simple example of single substitution"_case, { "Hello Worrd", "Hello World" }, 1 },
{ "Simple example of single addition"_case, { "Hello Worlda", "Hello World" }, 1 },
{ "Simple example of single removal"_case, { "Hello Worl", "Hello World" }, 1 },
{ "Simple example of single transposition"_case, { "Hello Wolrd", "Hello World" }, 2 },
{ "Two transposition"_case, { "xxxabxxxcdxxx", "xxxbaxxxdcxxx" }, 4 },
{ "Reversal case"_case, { "123456789", "987654321" }, 8 },
};
"Optimal string distance examples."_test <=TableTest< optimalStringDistance >::Cases
{
{ "Simple example of equality"_case, { "Hello World", "Hello World" }, 0 },
{ "Simple example of single substitution"_case, { "Hello Worrd", "Hello World" }, 1 },
{ "Simple example of single addition"_case, { "Hello Worlda", "Hello World" }, 1 },
{ "Simple example of single removal"_case, { "Hello Worl", "Hello World" }, 1 },
{ "Simple example of single transposition"_case, { "Hello Wolrd", "Hello World" }, 1 },
{ "Two transposition"_case, { "xxxabxxxcdxxx", "xxxbaxxxdcxxx" }, 2 },
{ "Reversal case"_case, { "123456789", "987654321" }, 8 },
};
};