Skip to content

Commit

Permalink
add nospaces function
Browse files Browse the repository at this point in the history
  • Loading branch information
erelsgl committed Mar 5, 2021
1 parent 457c75e commit 9baed71
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion TestExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,24 @@
using namespace ariel;

#include <string>
#include <algorithm>
using namespace std;

/**
* Returns the input string without the whitespace characters: space, newline and tab.
* Requires std=c++2a.
*/
string nospaces(string input) {
std::erase(input, ' ');
std::erase(input, '\t');
std::erase(input, '\n');
std::erase(input, '\r');
return input;
}


TEST_CASE("Good snowman code") {
CHECK(snowman(11114411) == string("_===_\n(.,.)\n( : )\n( : )"));
CHECK(nospaces(snowman(11114411)) == nospaces("_===_\n(.,.)\n( : )\n( : )"));
/* Add more checks here */
}

Expand Down

0 comments on commit 9baed71

Please sign in to comment.