Skip to content

Commit

Permalink
àdd unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Jan 16, 2025
1 parent 667adb0 commit 61479a7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/xtd.core.unit_tests/src/xtd/tests/string_comparer_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <xtd/string_comparer>
#include <xtd/time_span>
#include <xtd/tunit/assert>
#include <xtd/tunit/test_class_attribute>
#include <xtd/tunit/test_method_attribute>
Expand Down Expand Up @@ -26,6 +27,12 @@ namespace xtd::tests {
assert::is_negative(string_comparer::ordinal().compare("abc", "bca"));
}

void test_method_(string_comparer_ordinal_compare_with_time_span) {
assert::is_zero(string_comparer::ordinal().compare(time_span {}, time_span {}));
assert::is_positive(string_comparer::ordinal().compare(time_span {42}, time_span {21}));
assert::is_negative(string_comparer::ordinal().compare(time_span {21}, time_span {42}));
}

void test_method_(string_comparer_ordinal_ignore_case_compare_with_strings) {
assert::is_zero(string_comparer::ordinal_ignore_case().compare(string {""}, string {""}));
assert::is_zero(string_comparer::ordinal_ignore_case().compare(string {"abc"}, string {"abc"}));
Expand All @@ -43,5 +50,11 @@ namespace xtd::tests {
assert::is_positive(string_comparer::ordinal_ignore_case().compare("bca", "abc"));
assert::is_negative(string_comparer::ordinal_ignore_case().compare("abc", "bca"));
}

void test_method_(string_comparer_ordinal_ignore_case_compare_with_time_span) {
assert::is_zero(string_comparer::ordinal_ignore_case().compare(time_span {}, time_span {}));
assert::is_positive(string_comparer::ordinal_ignore_case().compare(time_span {42}, time_span {21}));
assert::is_negative(string_comparer::ordinal_ignore_case().compare(time_span {21}, time_span {42}));
}
};
}

0 comments on commit 61479a7

Please sign in to comment.