Skip to content

Instantly share code, notes, and snippets.

@dimavs
Created May 3, 2011 11:23
Show Gist options
  • Save dimavs/953187 to your computer and use it in GitHub Desktop.
Save dimavs/953187 to your computer and use it in GitHub Desktop.
Test for rr
#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