Advertisement
Guest User

Untitled

a guest
Sep 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.58 KB | None | 0 0
  1. #include "gtest/gtest.h"
  2. #include "funcs.h"
  3.  
  4. TEST(find_and_cut, partial_cut) {
  5.     const std::string line = "hasudhasu";
  6.     const std::string word = "a";
  7.     ASSERT_STREQ(
  8.         find_and_cut(line, word).c_str(),
  9.         "hsudhsu"
  10.     ) << "find_and_cut() doesn't seems to work";
  11. }
  12.  
  13. TEST(find_and_cut, full_cut) {
  14.     const std::string line = "hasudhasu";
  15.     const std::string word = "hasudhasu";
  16.     ASSERT_STREQ(
  17.         find_and_cut(line, word).c_str(),
  18.         ""
  19.     ) << "find_and_cut() doesn't seems to work with full cut";
  20. }
  21.  
  22. TEST(find_and_cut, no_cut) {
  23.     const std::string line = "hasudhasu";
  24.     const std::string word = "";
  25.     ASSERT_STREQ(
  26.         find_and_cut(line, word).c_str(),
  27.         "hasudhasu"
  28.     ) << "find_and_cut() doesn't seems to work with no cut";
  29. }
  30.  
  31. TEST(lower, equal) {
  32.     const std::string word = "ADASDasdqw";
  33.     ASSERT_STREQ(
  34.         lower(word).c_str(),
  35.         "adasdasdqw"
  36.     ) << "lower() doesn't seems to work";
  37. }
  38.  
  39. TEST(sorting, normal) {
  40.     std::vector<std::string> vs_test = {
  41.         "Asd",
  42.         "Cwe",
  43.         "Ber"
  44.     };
  45.     vs_test = sort_ignorcase(vs_test);
  46.     ASSERT_STREQ(
  47.         vs_test[0].c_str(),
  48.         "Asd"
  49.     );
  50.     ASSERT_STREQ(
  51.         vs_test[1].c_str(),
  52.         "Cwe"
  53.     );
  54.     ASSERT_STREQ(
  55.         vs_test[2].c_str(),
  56.         "Ber"
  57.     );
  58. }
  59.  
  60. TEST(sorting, ignorcase) {
  61.     std::vector<std::string> vs_test = {
  62.         "Asd",
  63.         "abe",
  64.         "Ber"
  65.     };
  66.     vs_test = sort_ignorcase(vs_test);
  67.     ASSERT_STREQ(
  68.         vs_test[0].c_str(),
  69.         "abe"
  70.     );
  71.     ASSERT_STREQ(
  72.         vs_test[1].c_str(),
  73.         "Asd"
  74.     );
  75.     ASSERT_STREQ(
  76.         vs_test[2].c_str(),
  77.         "Ber"
  78.     );
  79. }
  80.  
  81. int main(int argc, char** argv)
  82. {
  83.     ::testing::InitGoogleTest(&argc, argv);
  84.     return RUN_ALL_TESTS();
  85. }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement