-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestac.cpp
More file actions
42 lines (38 loc) · 1.03 KB
/
testac.cpp
File metadata and controls
42 lines (38 loc) · 1.03 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
#include "autocomplete.h"
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void testAC01() {
cout << "Starting AC test01" << endl;
cout << "* Testing basic autocomplete" << endl;
Autocomplete ac;
ac.readFile("small.txt");
auto v = ac.complete("hel");
assert(v.size() == 2);
assert(v[0].first == "help");
assert(v[0].second == 20);
assert(v[1].first == "hello");
assert(v[1].second == 10);
cout << "Ending tesAC01" << endl;
}
void testAC02() {
cout << "Starting AC test02" << endl;
cout << "* Testing cities autocomplete" << endl;
Autocomplete ac;
ac.readFile("cities.txt");
auto v = ac.complete("Sea");
assert(v.size() == 47);
assert(v[0].first == "Seattle, Washington, United States");
assert(v[0].second == 608660);
assert(v[46].first == "Seabeck, Washington, United States");
assert(v[46].second == 1105);
cout << "Ending tesAC02" << endl;
}
// // Calling all test functions
void testACAll() {
testAC01();
testAC02();
// TODO(student) Add more tests
}