-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgather_tokens.h
39 lines (27 loc) · 1.12 KB
/
gather_tokens.h
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
#include <gtest/gtest.h>
#include <map>
#include <set>
#include <string>
#include "search.h"
using namespace std;
TEST(GatherTokens, BasicTest) {
string text = "to be ora not to be";
set<string> expected = {"to", "be", "ora", "not"};
set<string> studentResult = gatherTokens(text);
string testFeedback = "gatherTokens(\"" + text + "\") incorrect\n";
EXPECT_EQ(expected, studentResult) << testFeedback;
}
TEST(GatherTokens, Nom) {
string text = "I'm not trying to eat you!";
set<string> expected = {"i'm", "not", "trying", "to", "eat", "you"};
set<string> studentResult = gatherTokens(text);
string testFeedback = "gatherTokens(\"" + text + "\") incorrect\n";
EXPECT_EQ(expected, studentResult) << testFeedback;
}
TEST(GatherTokens, Colors) {
string text = "red ~gre-en~ orange, yellow + blue (indigo) &violet";
set<string> expected = {"red", "gre-en", "orange", "blue", "indigo", "violet", "yellow"};
set<string> studentResult = gatherTokens(text);
string testFeedback = "gatherTokens(\"" + text + "\") incorrect\n";
EXPECT_EQ(expected, studentResult) << testFeedback;
}