forked from Alepha/Alepha
String distance algorithms.
This commit is contained in:
35
Algorithm/string_distance.test/0.cc
Normal file
35
Algorithm/string_distance.test/0.cc
Normal file
@ -0,0 +1,35 @@
|
||||
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 },
|
||||
};
|
||||
};
|
||||
1
Algorithm/string_distance.test/CMakeLists.txt
Normal file
1
Algorithm/string_distance.test/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
unit_test( 0 )
|
||||
Reference in New Issue
Block a user