Created
May 3, 2011 11:23
-
-
Save dimavs/953187 to your computer and use it in GitHub Desktop.
Test for rr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<gtest/gtest.h> | |
TEST(Rr, Empty) | |
{ | |
std::string str(""); | |
unsigned int num = reverse_and_replace(str); | |
EXPECT_EQ(0, num); | |
EXPECT_EQ("", str); | |
} | |
TEST(Rr, Odd) | |
{ | |
std::string str("abc\\123"); | |
unsigned int num = reverse_and_replace(str); | |
EXPECT_EQ(1, num); | |
EXPECT_EQ("321/cba", str); | |
} | |
TEST(Rr, Even) | |
{ | |
std::string str("ab\\c\\01234"); | |
unsigned int num = reverse_and_replace(str); | |
EXPECT_EQ(2, num); | |
EXPECT_EQ("43210/c/ba", str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment