Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : */
8 :
9 : #ifndef TEST_H
10 : #define TEST_H
11 :
12 : #include <string>
13 : #include <vector>
14 :
15 : #include "coloredkdbio.hpp"
16 : #include <command.hpp>
17 : #include <kdb.hpp>
18 :
19 : class TestCommand : public Command
20 : {
21 : kdb::Key root;
22 : int nrTest;
23 : int nrError;
24 : std::string testNames;
25 :
26 : public:
27 : TestCommand ();
28 : ~TestCommand ();
29 :
30 : void doTests (std::vector<std::string> const & arguments);
31 :
32 : void doBasicTest ();
33 : void doStringTest ();
34 : void doUmlautsTest ();
35 : void doBinaryTest ();
36 : void doNamingTest ();
37 : void doMetaTest ();
38 :
39 0 : virtual std::string getShortOptions () override
40 : {
41 0 : return "";
42 : }
43 :
44 0 : virtual std::string getSynopsis () override
45 : {
46 0 : return "<root-key> [<test-name> ...]";
47 : }
48 :
49 78 : virtual std::string getShortHelpText () override
50 : {
51 234 : return "Run key database test suite.";
52 : }
53 :
54 0 : virtual std::string getLongHelpText () override
55 : {
56 : return "This command runs an internal test suite.\n"
57 : "The tests will set and get many keys below\n"
58 : "the given rootkey.\n"
59 : "\n"
60 : "The main purpose of these tests is to check\n"
61 : "if a backend is capable of storing and retrieving\n"
62 : "all kinds of configuration keys and values.\n"
63 : "\n"
64 : "If no test name is given, every available test\n"
65 : " is executed.\n"
66 : "\n"
67 : "Following tests are available:" +
68 0 : testNames;
69 : }
70 :
71 : virtual int execute (Cmdline const & cmdline) override;
72 : };
73 :
74 : #endif
|