-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordCountTests.cpp
More file actions
60 lines (48 loc) · 1.07 KB
/
wordCountTests.cpp
File metadata and controls
60 lines (48 loc) · 1.07 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "stdafx.h"
extern "C" {
#include "../RecognizePattern/wordCount.h"
}
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace RecognizePatternTests
{
TEST_CLASS(WordCountTest)
{
public:
TEST_METHOD(wordCountForEmptyString)
{
Assert::AreEqual(0, count(""));
}
TEST_METHOD(wordCountForSingleWord)
{
Assert::AreEqual(1, count("Hallo"));
}
TEST_METHOD(wordCountForWhitespaceAndSingleWord)
{
Assert::AreEqual(1, count(" Hallo"));
}
TEST_METHOD(wordCountForSingleWordAndWhitespace)
{
Assert::AreEqual(1, count("Hallo "));
}
TEST_METHOD(wordCountForSingleWordAndMixedWhitespace)
{
Assert::AreEqual(1, count(" Hallo "));
}
TEST_METHOD(wordCountForTwoWords)
{
Assert::AreEqual(2, count("Hal lo"));
}
TEST_METHOD(wordCountForWhitespaceAndTwoWords)
{
Assert::AreEqual(2, count(" Hal lo"));
}
TEST_METHOD(wordCountForTwoWordsAndWhitespace)
{
Assert::AreEqual(2, count("Hal lo "));
}
TEST_METHOD(wordCountForTwoWordsAndMixedWhitespace)
{
Assert::AreEqual(2, count(" Hal lo "));
}
};
}