-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestExample.cpp
44 lines (36 loc) · 963 Bytes
/
TestExample.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* An example of how to write unit tests.
* Use this as a basis to build a more complete Test.cpp file.
*
* IMPORTANT: Please write more tests - the tests here are only for example and are not complete.
*
* AUTHORS: <Please write your names here>
*
* Date: 2021-02
*/
#include "doctest.h"
#include "snowman.hpp"
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(nospaces(snowman(11114411)) == nospaces("_===_\n(.,.)\n( : )\n( : )"));
/* Add more checks here */
}
TEST_CASE("Bad snowman code") {
CHECK_THROWS(snowman(555));
/* Add more checks here */
}
/* Add more test cases here */