#include <string>
#include <algorithm>
using namespace std;
#include "utx.h"
string toUpperCase(const string& s)
{
string s1 = s;
transform(s1.begin(), s1.end(), s1.begin(), toupper);
return s1;
}
void toUpperCaseInPlace(string& s)
{
transform(s.begin(), s.end(), s.begin(), toupper);
}
TEST(uppercase)
{
string s = "aBc";
utxassert(toUpperCase(s), "ABC");
utxassert(toUpperCase(string("CDE")), "CDE");
}
TEST(uppercaseInPlace)
{
string s = "aBc";
toUpperCaseInPlace(s);
utxassert(s, "ABC");
s = "CDE";
toUpperCaseInPlace(s);
utxassert(s, "CDE");
}
|