Spinning Topp Logo BlackTopp Studios
inc
testenumerations.h
Go to the documentation of this file.
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 _unittestenumerations_h
41 #define _unittestenumerations_h
42 
43 /// @file
44 /// @brief Enumerations and constant values associated with the Unit tests
45 
46 #include "datatypes.h"
47 
48 namespace Mezzanine
49 {
50  namespace Testing
51  {
52  /// @brief Possible ways to exit the UnitTestGroup Program
53  enum ExitCodes
54  {
55  ExitSuccess = 0, ///< Normal exit all tests skipped or better
56  ExitInvalidArguments = 1, ///< At least some invalid args were passed on the command line
57  ExitFailure = 2 ///< At least one test return worse then skipped
58  };
59 
60  /// @brief Return values from tests.
61  /// @details These are loosely order from best to worse, in terms of
62  /// what we want to see from our tests. This takes the midset that
63  /// knowing about a failure is better than not knowing about it.
65  {
66  Success = 0, ///< Test was ran and appeared to work
67  Warning = 1, ///< Technically the test passed but there is something that is not quite right.
68  Skipped = 2, ///< Test was simply not ran at the behest of the user
69  Cancelled = 3, ///< Was canceled by user, so success is unknown, but user knows test was canceled.
70  Inconclusive = 4, ///< If a user answers that with "don't know" in a test that involved interaction, The user knows there is a potential issue.
71  Failed = 5, ///< Known failure
72  Unknown = 6, ///< Since we don't know what happened this is the worst kind of failure.
73  NotApplicable = 7 ///< This is not even a kind of failure, This is used to when referencing a test, so if this winds up coming out of a test, then something has failed.
74  };
75 
76  /// @brief Corresponds to TestResult::Success
77  const Mezzanine::String SuccessString("Success");
78  /// @brief Corresponds to TestResult::Warning
79  const Mezzanine::String WarningString("Warning");
80  /// @brief Corresponds to TestResult::Skipped
81  const Mezzanine::String SkippedString("Skipped");
82  /// @brief Corresponds to TestResult::Cancelled
83  const Mezzanine::String CancelledString("Cancelled");
84  /// @brief Corresponds to TestResult::Inconclusive
85  const Mezzanine::String InconclusiveString("Inconclusive");
86  /// @brief Corresponds to TestResult::Failed
87  const Mezzanine::String FailedString("Failed");
88  /// @brief Corresponds to TestResult::Unknown
89  const Mezzanine::String UnknownString("Unknown");
90  /// @brief Corresponds to TestResult::NotApplicable
91  const Mezzanine::String NotApplicableString("NotApplicable");
92 
93  /// @brief This converts A test result enum value into a String matching the identifier name.
94  /// @param Convertable A TestResult inclusively between Success and NotApplicable.
95  /// @return A string like "Success" or "Inconclusive" or similar.
96  /// @throw If an int not in the valid range of TestResult is passed in then this will throw a PARAMETERS_EXCEPTION
98 
99  /// @brief Roughly convert a String to a TestResult.
100  /// @param Text If this matches a word like "Success", "Skipped", "Cancelled", "Inconclusive", "Failed", "Unknown" or "N/A" exactly as returned by @ref TestResultToString then a valid result can be returned.
101  /// @return The @ref TestResult corresponding to the String passed in.
102  /// @throw If the string passed in does not match a valid TestResult then this will throw a PARAMETERS_EXCEPTION
104 
105  /// @brief This is used to control the behavior of the function UnitTestGroup::AddTestResult()
106  /// @details This can optionally be passedto prioritize whether newer vs older or successful vs failing results are more important
108  OverWriteIfLessSuccessful, ///< This is the default behavior, because it is presumed failures should be visible so they can be fixed.
109  OverWriteIfMoreSuccessful, ///< Overwrite only if the result is better than the old result.
110  OverWrite, ///< Just Overwrite, useful if the test was defaulted to a low value
111  DoNotOverWrite ///< This is a supplementary running a test, if a results already exists, skip writing anything.
112  };
113 
114  }// Testing
115 }// Mezzanine
116 
117 #endif
const Mezzanine::String FailedString("Failed")
Corresponds to TestResult::Failed.
const Mezzanine::String InconclusiveString("Inconclusive")
Corresponds to TestResult::Inconclusive.
const Mezzanine::String NotApplicableString("NotApplicable")
Corresponds to TestResult::NotApplicable.
const Mezzanine::String UnknownString("Unknown")
Corresponds to TestResult::Unknown.
At least one test return worse then skipped.
Mezzanine::String TestResultToString(TestResult Convertable)
This converts A test result enum value into a String matching the identifier name.
const Mezzanine::String CancelledString("Cancelled")
Corresponds to TestResult::Cancelled.
This is the default behavior, because it is presumed failures should be visible so they can be fixed...
Just Overwrite, useful if the test was defaulted to a low value.
All the definitions for datatypes as well as some basic conversion functions are defined here...
At least some invalid args were passed on the command line.
This is not even a kind of failure, This is used to when referencing a test, so if this winds up comi...
const Mezzanine::String WarningString("Warning")
Corresponds to TestResult::Warning.
Test was simply not ran at the behest of the user.
const Mezzanine::String SkippedString("Skipped")
Corresponds to TestResult::Skipped.
OverWriteResults
This is used to control the behavior of the function UnitTestGroup::AddTestResult() ...
TestResult StringToTestResult(Mezzanine::String Text)
Roughly convert a String to a TestResult.
Since we don't know what happened this is the worst kind of failure.
const Mezzanine::String SuccessString("Success")
Corresponds to TestResult::Success.
Technically the test passed but there is something that is not quite right.
TestResult
Return values from tests.
Normal exit all tests skipped or better.
This is a supplementary running a test, if a results already exists, skip writing anything...
If a user answers that with "don't know" in a test that involved interaction, The user knows there is...
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
Was canceled by user, so success is unknown, but user knows test was canceled.
Test was ran and appeared to work.
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
ExitCodes
Possible ways to exit the UnitTestGroup Program.
Overwrite only if the result is better than the old result.