string_test.cpp 901 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ///////////////////////////////////////////////////////////////////////////////////////
  2. /// \file string_test.cpp
  3. /// \brief Unit tests functionality in guessstring.h
  4. ///
  5. /// \author Joe Siltberg
  6. /// $Date$
  7. ///
  8. ///////////////////////////////////////////////////////////////////////////////////////
  9. #include "config.h"
  10. #include "catch.hpp"
  11. #include "guessstring.h"
  12. TEST_CASE("trim", "Tests for trim()") {
  13. REQUIRE(trim("") == "");
  14. REQUIRE(trim(" ") == "");
  15. REQUIRE(trim(" trim \t\n ") == "trim");
  16. REQUIRE(trim("a b") == "a b");
  17. REQUIRE(trim(" a b ") == "a b");
  18. }
  19. TEST_CASE("to_upper", "Tests for to_upper()") {
  20. REQUIRE(to_upper("abc") == "ABC");
  21. REQUIRE(to_upper("a b c") == "A B C");
  22. REQUIRE(to_upper("1") == "1");
  23. }
  24. TEST_CASE("to_lower", "Tests for to_lower()") {
  25. REQUIRE(to_lower("AbC") == "abc");
  26. REQUIRE(to_lower("A B C") == "a b c");
  27. REQUIRE(to_lower("1") == "1");
  28. }