1: //test_textitems.cpp
2: //A test driver for the Scobey::TextItems class.
4: #include <iostream>
5: #include <string>
6: using namespace std;
8: #include "utilities.h"
9: using Scobey::TextItems;
10: using Scobey::Pause;
11: using Scobey::ReadNextLine;
13: int main()
14: {
15: Pause(0, "\nTesting the Scobey::TextItems class ...\n"
16: "\nThis program demonstrates use of the TextItems class to "
17: "display \"text items\".\nBe sure that you know what a file "
18: "of such items looks like, and that you have\nat least one "
19: "available, before you attempt to use this program.");
21: string fileName;
22: ReadNextLine(">>>>> Enter full name of text items file,"
23: "\n>>>>> or just press Enter to quit this test:", fileName);
24: while (fileName != "")
25: {
26: TextItems itemList(fileName.c_str());
27: string title;
28: ReadNextLine("\n===== Enter title of text item to display, or"
29: "\n===== just press Enter to quit displaying items:", title);
30: while (title != "")
31: {
32: itemList.displayItem(title);
33: ReadNextLine("===== Enter title of text item to display, or"
34: "\n===== just press Enter to quit displaying items:", title);
35: }
36: cin.clear();
37: ReadNextLine(">>>>> Enter full name of text items file, or"
38: "\n>>>>> just press Enter to quit program:", fileName);
39: }
41: Pause(0, "No more tests to perform."
42: "\nProgram will now terminate.");
43: }