SolidUtils
Macros | Functions | Variables
UnitTest.hpp File Reference

Top level header for UnitTest. More...

#include <stdexcept>
#include <exception>
#include <string>
#include <iostream>
#include <sstream>
#include <cmath>

Go to the source code of this file.

Macros

#define testFail()
 
#define testEqual(a, b)
 
#define testNotEqual(a, b)
 
#define testTrue(a)
 
#define testFalse(a)
 
#define testGreater(a, b)
 
#define testGreaterOrEqual(a, b)
 
#define testLess(a, b)
 
#define testLessOrEqual(a, b)
 
#define testNearEqual(a, b, c, d)
 
#define UNITTEST(CLASS, TEST)
 

Functions

int main (int argc, char **argv)
 

Variables

volatile int sl::_unittest_numberFailed = 0
 
volatile int sl::_unittest_numberPassed = 0
 

Detailed Description

Top level header for UnitTest.

Author
Dominique LaSalle domin.nosp@m.ique.nosp@m.@soli.nosp@m.dlak.nosp@m.e.com Copyright 2015-2017, Dominique LaSalle Copyright 2017-2018, Solid Lake LLC
Version
1
Date
2015-08-22

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Macro Definition Documentation

◆ testEqual

#define testEqual (   a,
 
)
Value:
sl::TestStream().testEqual(a,b) << #a << ":'" << (a) \
<< "' != " << #b << ":'" << (b) << "' at " << __LINE__ << std::endl

◆ testFail

#define testFail ( )
Value:
sl::TestStream().testFail() << "testFail() called at " << __LINE__ << \
std::endl

◆ testFalse

#define testFalse (   a)
Value:
sl::TestStream().testFalse(a) << #a << "' is true at: " << __LINE__ \
<< std::endl

◆ testGreater

#define testGreater (   a,
 
)
Value:
sl::TestStream().testGreater(a,b) << #a << ":'" << (a) << "' <= " << #b \
<< ":'" << (b) << "' at " << __LINE__ << std::endl

◆ testGreaterOrEqual

#define testGreaterOrEqual (   a,
 
)
Value:
sl::TestStream().testGreaterOrEqual(a,b) << #a << ":'" << (a) << "' < " << \
#b << ":'" << (b) << "' at " << __LINE__ << std::endl

◆ testLess

#define testLess (   a,
 
)
Value:
sl::TestStream().testLess(a,b) << #a << ":'" << (a) << "' >= " << #b << \
":'" << (b) << "' at " << __LINE__ << std::endl

◆ testLessOrEqual

#define testLessOrEqual (   a,
 
)
Value:
sl::TestStream().testLessOrEqual(a,b) << #a << ":'" << (a) << "' > " << #b \
<< ":'" << (b) << "' at " << __LINE__ << std::endl

◆ testNearEqual

#define testNearEqual (   a,
  b,
  c,
 
)
Value:
sl::TestStream().testNearEqual(a, b, c, d) << #a << ":'" << (a) \
<< "' != " << #b << ":'" << (b) << "' at " << __LINE__ << std::endl

◆ testNotEqual

#define testNotEqual (   a,
 
)
Value:
sl::TestStream().testNotEqual(a,b) << #a << ":'" << (a) \
<< "' == " << #b << ":'" << (b) << "' at " << __LINE__ << std::endl

◆ testTrue

#define testTrue (   a)
Value:
sl::TestStream().testTrue(a) << #a << "' is false at: " << __LINE__ \
<< std::endl

◆ UNITTEST

#define UNITTEST (   CLASS,
  TEST 
)
Value:
void _unittest_ ## CLASS ## _ ## TEST ## _func(void); \
bool _unittest_ ## CLASS ## _ ## TEST ## _result = \
sl::UnitTest( \
__FILE__":"#CLASS"->"#TEST, \
_unittest_ ## CLASS ## _ ## TEST ## _func); \
void _unittest_ ## CLASS ## _ ## TEST ## _func(void) \