MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / test

Function test

code/strings/trie.test.cpp:3–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1/* Field testing: UVa 12526 */
2
3void test() {
4
5 trie<char> t; string s;
6
7 s = "";
8 assert_equal(0, t.countMatches(s.begin(), s.end()));
9
10 s = "X";
11 assert_equal(0, t.countMatches(s.begin(), s.end()));
12
13 s = "XX";
14 assert_equal(0, t.countMatches(s.begin(), s.end()));
15
16 s = "XXX";
17 assert_equal(0, t.countMatches(s.begin(), s.end()));
18
19 s = "Hello, World!";
20 assert_equal(0, t.countMatches(s.begin(), s.end()));
21
22 s = "";
23 assert_equal(0, t.countPrefixes(s.begin(), s.end()));
24
25 s = "X";
26 assert_equal(0, t.countPrefixes(s.begin(), s.end()));
27
28 s = "XX";
29 assert_equal(0, t.countPrefixes(s.begin(), s.end()));
30
31 s = "XXX";
32 assert_equal(0, t.countPrefixes(s.begin(), s.end()));
33
34 s = "Hello, World!";
35 assert_equal(0, t.countPrefixes(s.begin(), s.end()));
36
37 s = "XX";
38 t.insert(s.begin(), s.end());
39
40 s = "";
41 assert_equal(0, t.countMatches(s.begin(), s.end()));
42
43 s = "X";
44 assert_equal(0, t.countMatches(s.begin(), s.end()));
45
46 s = "XX";
47 assert_equal(1, t.countMatches(s.begin(), s.end()));
48
49 s = "XXX";
50 assert_equal(0, t.countMatches(s.begin(), s.end()));
51
52 s = "Hello, World!";
53 assert_equal(0, t.countMatches(s.begin(), s.end()));
54
55 s = "";
56 assert_equal(1, t.countPrefixes(s.begin(), s.end()));
57
58 s = "X";
59 assert_equal(1, t.countPrefixes(s.begin(), s.end()));
60

Callers

nothing calls this directly

Calls 4

countMatchesMethod · 0.80
countPrefixesMethod · 0.80
assert_equalFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected