diff options
author | Martin Fischer <martin@push-f.com> | 2021-12-05 01:44:45 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-12-05 01:53:28 +0100 |
commit | 799f2d02bea9bb16780bce01d4f3d831954bf9f0 (patch) | |
tree | a9c2d425aee007cf0f16cd2172f5f1a88f31d18b /test/src/CharacterSetTests.cpp | |
parent | c3255c4473dd3976361ac52899c504c7f70c4be9 (diff) |
remove C++ implementation
Diffstat (limited to 'test/src/CharacterSetTests.cpp')
-rw-r--r-- | test/src/CharacterSetTests.cpp | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/test/src/CharacterSetTests.cpp b/test/src/CharacterSetTests.cpp deleted file mode 100644 index 3663ee6..0000000 --- a/test/src/CharacterSetTests.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @file CharacterSetTests.cpp - * - * This module contains the unit tests of the Uri::CharacterSet class. - * - * © 2018 by Richard Walters - */ - -#include <gtest/gtest.h> -#include <src/CharacterSet.hpp> -#include <utility> -#include <vector> - -TEST(CharacterSetTests, DefaultConstructor) { - Uri::CharacterSet cs; - for (char c = 0; c < 0x7F; ++c) { - ASSERT_FALSE(cs.Contains(c)); - } -} - -TEST(CharacterSetTests, SingleCharacterConstructor) { - Uri::CharacterSet cs('X'); - for (char c = 0; c < 0x7F; ++c) { - if (c == 'X') { - ASSERT_TRUE(cs.Contains(c)); - } else { - ASSERT_FALSE(cs.Contains(c)); - } - } -} - -TEST(CharacterSetTests, RangeConstructor) { - Uri::CharacterSet cs('A', 'G'); - for (char c = 0; c < 0x7F; ++c) { - if ( - (c >= 'A') - && (c <= 'G') - ) { - ASSERT_TRUE(cs.Contains(c)); - } else { - ASSERT_FALSE(cs.Contains(c)); - } - } -} - -TEST(CharacterSetTests, Range_Constructor_Reversed) { - Uri::CharacterSet cs('G', 'A'); - for (char c = 0; c < 0x7F; ++c) { - if ( - (c >= 'A') - && (c <= 'G') - ) { - ASSERT_TRUE(cs.Contains(c)); - } else { - ASSERT_FALSE(cs.Contains(c)); - } - } -} - -TEST(CharacterSetTests, InitializerListConstructor) { - Uri::CharacterSet cs1{'X'}; - for (char c = 0; c < 0x7F; ++c) { - if (c == 'X') { - ASSERT_TRUE(cs1.Contains(c)); - } else { - ASSERT_FALSE(cs1.Contains(c)); - } - } - Uri::CharacterSet cs2{'A', 'G'}; - for (char c = 0; c < 0x7F; ++c) { - if ( - (c == 'A') - || (c == 'G') - ) { - ASSERT_TRUE(cs2.Contains(c)); - } else { - ASSERT_FALSE(cs2.Contains(c)); - } - } - Uri::CharacterSet cs3{Uri::CharacterSet('f', 'i')}; - for (char c = 0; c < 0x7F; ++c) { - if ( - (c >= 'f') - && (c <= 'i') - ) { - ASSERT_TRUE(cs3.Contains(c)); - } else { - ASSERT_FALSE(cs3.Contains(c)); - } - } - Uri::CharacterSet cs4{Uri::CharacterSet('a', 'c'), Uri::CharacterSet('f', 'i')}; - for (char c = 0; c < 0x7F; ++c) { - if ( - ( - (c >= 'a') - && (c <= 'c') - ) - || ( - (c >= 'f') - && (c <= 'i') - ) - ) { - ASSERT_TRUE(cs4.Contains(c)); - } else { - ASSERT_FALSE(cs4.Contains(c)); - } - } - Uri::CharacterSet cs5{Uri::CharacterSet('a', 'c'), Uri::CharacterSet('x')}; - for (char c = 0; c < 0x7F; ++c) { - if ( - ( - (c >= 'a') - && (c <= 'c') - ) - || (c == 'x') - ) { - ASSERT_TRUE(cs5.Contains(c)); - } else { - ASSERT_FALSE(cs5.Contains(c)); - } - } -} |