This commit is contained in:
2018-07-31 10:50:06 -04:00
parent c040135305
commit 58fa6f0503
45 changed files with 504 additions and 295 deletions
+13 -6
View File
@@ -1,21 +1,27 @@
#include "UTest.hpp"
const /*static*/ char * UTest::sp_pstr = "pass";
const /*static*/ char * UTest::sp_fstr = "fail";
#include <stdio.h>
/*static*/ const char* UTest::sp_pstr = "pass";
/*static*/ const char* UTest::sp_fstr = "fail";
/*static*/ unsigned long int UTest::s_pass = 0;
/*static*/ unsigned long int UTest::s_fail = 0;
UTest::UTest( const char * tstr ) {
UTest::UTest( const char* tstr )
: m_pass(0), m_fail(0)
{
init(tstr);
}
void UTest::init( const char * tstr ) {
void UTest::init( const char* tstr )
{
mp_tstr = tstr;
m_pass = m_fail = 0;
}
void UTest::test( const char * description, const int flag ) {
void UTest::test( const char* description, const int flag )
{
const char * pf = nullptr;
if (flag) {
pf = sp_pstr;
@@ -29,7 +35,8 @@ void UTest::test( const char * description, const int flag ) {
printf("%s: %s -> %s\n", mp_tstr, description, pf);
}
void UTest::report() const {
void UTest::report() const
{
printf("%s: pass: %ld, fail: %ld\n", mp_tstr, m_pass, m_fail);
}
+9 -11
View File
@@ -1,8 +1,6 @@
#ifndef __UTEST__
#define __UTEST__
#include <cstdio>
#define __UTest_VERSION "1.0.0"
class UTest {
@@ -11,11 +9,11 @@ private:
UTest operator = ( UTest & ); // no assignment operator
UTest(){}
public:
static const char * version() { return __UTest_VERSION; }
static const char* version() { return __UTest_VERSION; }
UTest( const char * );
void init( const char * );
void test( const char * description, const int flag );
UTest( const char* tstr );
void init( const char* tstr );
void test( const char* description, const int flag );
void report() const;
static void OverAllReport();
@@ -24,13 +22,13 @@ private:
unsigned long int m_pass = 0;
unsigned long int m_fail = 0;
const char * mp_tstr = nullptr;
const char* mp_tstr = nullptr;
const static char * sp_pstr; /*= "pass";*/
const static char * sp_fstr; /*= "fail";*/
static const char* sp_pstr; /*= "pass";*/
static const char* sp_fstr; /*= "fail";*/
static unsigned long int s_pass;
static unsigned long int s_fail;
static unsigned long int s_pass; //= 0
static unsigned long int s_fail; //= 0
};
#endif // __UTEST__