Spinning Topp Logo BlackTopp Studios
inc
mezztest.h
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _mezztests_h
41 #define _mezztests_h
42 
43 #include "consolelogic.h"
45 #include "testdata.h"
46 #include "testdatatools.h"
47 #include "testenumerations.h"
48 
49 #include <stdexcept> // Used to throw for TEST_THROW
50 
51 /// @brief Get the argument count as it was passed into Main.
52 /// @return This is returned as an int
54 
55 /// @brief Get the argument vector as it was passed into Main.
56 /// @return This is returned as pointer to a null terminated array of pointers to null terminated characters.
57 char** GetMainArgumentVector();
58 
59 /// @brief Get the command/executable name used to invoke this at the command prompt.
60 /// @return This is returned as a String.
62 
63 /// @brief Used to indicate the current 'depth' in the subprocess tree.
64 /// @details Since the caller of the unit tests can pass arbitrary gibberish
65 /// It is possible to get things that houldonly run in subsubprocesses in the
66 /// main test process. This does not truly indicate how many processes have
67 /// been spawned, but rather indicates the plans for what will be executed.
68 enum ProcessDepth {
69  MainProcess = 0, ///< The is no plan to execute tests in this process subprocesses will be launched for any tests.
70  TestSubprocess = 1, ///< One or Tests will be executed in this process, but no subprocess requested by tests will be run.
71  TestSubSubProcess = 2 ///< Tests requested to run in subrocesse by individual testswill run in this process.
72 };
73 
74 /// @brief Indicates what this test might attempt to do, based on what it thinks the process depth is.
75 /// @return a ProcessDepth enum member
76 ProcessDepth GetCurrentProcessDepth();
77 
78 /// @brief If a test needs to pass a string to a subsubprocess it will get stored here
79 /// @return A string that a test group intends on passing into a subsubprocess test
81 
82 /// @internal
83 /// @brief If this is passed to the command line the test is executed without launching a separate processs.
84 /// @details In most cases each test is launched as a separate process and this is passed to it.
85 static const Mezzanine::String MemSpaceArg("debugtests");
86 
87 /// @internal
88 /// @brief If this is passed to the command line prepended to a testname that tests subprocess will be executed instead of that test
89 static const Mezzanine::String SubTestPrefix("debug");
90 
91 /// @internal
92 /// @brief This is the name of the file used to communicate results from child processes
93 /// @warning This variable is used to create temporary files in a percieved insecure way
94 /// Everything will be fine as long as nothing else writes to this this file during or
95 /// between Tests. If something does, then you probably have big enough problems you
96 /// shouldn't be developing software until that is fixed.
97 static const Mezzanine::String TempFile("UnitTestWork.txt");
98 
99 
100 
101 
102 #endif
Mezzanine::String GetExecutableName()
Get the command/executable name used to invoke this at the command prompt.
Definition: mezztest.cpp:77
Enumerations and constant values associated with the Unit tests.
Some string manipulation functions geared towards console output for use in the Unit Tests...
TestData, TestDataStorage and UnitTestGroup class definitions.
ProcessDepth GetCurrentProcessDepth()
Indicates what this test might attempt to do, based on what it thinks the process depth is...
Definition: mezztest.cpp:83
Mezzanine::String GetSubSubProcessArgument()
If a test needs to pass a string to a subsubprocess it will get stored here.
Definition: mezztest.cpp:89
The definition of a few command line tools.
int GetMainArgumentCount()
Get the argument count as it was passed into Main.
Definition: mezztest.cpp:63
TestData, TestDataStorage and UnitTestGroup class definitions.
char ** GetMainArgumentVector()
Get the argument vector as it was passed into Main.
Definition: mezztest.cpp:71
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159