-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathTestST.cpp.in
More file actions
84 lines (80 loc) · 2.3 KB
/
TestST.cpp.in
File metadata and controls
84 lines (80 loc) · 2.3 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright (C) 2024-2026 landerrosette <57791410+landerrosette@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/******************************************************************************
* % more tinyST.txt
* S E A R C H E X A M P L E
*
* % ./Test@ST@ < tinyST.txt
* ...
*
* % ./TestRedBlackBST 10 < tinyST.txt
* ...
*
* % more shellsST.txt
* she sells sea shells by the sea shore
*
* % ./TestTrieST < shellsST.txt
* ...
*
* % ./TestTST < shellsST.txt
* ...
******************************************************************************/
#include <iostream>
#include <string>
#include "STTestUtils.hpp"
#ifdef ORDERED
#include "OrderedSTTestUtils.hpp"
#endif
#ifdef STRING
#include "StringSTTestUtils.hpp"
#endif
#ifdef BALANCED_TREE
#include "BalancedTreeTestUtils.hpp"
#endif
#include "algs4/@ST@.hpp"
int main(int argc, char* argv[]) {
#ifndef STRING
algs4::@ST@<std::string, int> st{@ST_INIT_ARGS@};
#else
algs4::@ST@<int> st{@ST_INIT_ARGS@};
#endif
STTestUtils::init(st, std::cin, std::cout);
std::cout << std::endl;
STTestUtils::testKeys(st, std::cout);
std::cout << std::endl;
#ifdef ORDERED
STTestUtils::testOrderedST(st, std::cout);
std::cout << std::endl;
#endif
#ifdef STRING
STTestUtils::testStringST(st, std::cout);
std::cout << std::endl;
#endif
STTestUtils::removeSome(st, std::cout);
std::cout << std::endl;
STTestUtils::removeAll(st, std::cout);
#ifdef BALANCED_TREE
if (argc > 1) {
if (int n = std::stoi(argv[1]); n > 0) {
std::cout << std::endl;
algs4::@ST@<int, int> st2{@ST_INIT_ARGS@};
STTestUtils::testRedBlackBST(st2, n, std::cout);
}
}
#endif
return 0;
}