Skip to content

Commit

Permalink
Algos: add toLower tests (#1136)
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui authored Jan 31, 2025
1 parent e880e72 commit fe4a3e1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Algos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,28 @@ namespace tests {
using namespace cabin; // NOLINT(build/namespaces,google-build-using-namespace)
using std::string_view_literals::operator""sv;

static void
testToLower() {
static_assert(toLower('A') == 'a');
static_assert(toLower('Z') == 'z');
static_assert(toLower('M') == 'm');

static_assert(toLower('a') == 'a');
static_assert(toLower('z') == 'z');

static_assert(toLower('@') == '@');
static_assert(toLower('[') == '[');

static_assert(toLower('0') == '0');
static_assert(toLower('9') == '9');

static_assert(toLower('!') == '!');
static_assert(toLower(' ') == ' ');
static_assert(toLower('~') == '~');

pass();
}

static void
testLevDistance() {
// Test bytelength agnosticity
Expand Down Expand Up @@ -188,6 +210,7 @@ testFindSimilarStr2() {

int
main() {
tests::testToLower();
tests::testLevDistance();
tests::testLevDistance2();
tests::testFindSimilarStr();
Expand Down

0 comments on commit fe4a3e1

Please sign in to comment.