31 lines
581 B
Plaintext
31 lines
581 B
Plaintext
#include "UTest.hpp"
|
|
|
|
const /*static*/ char * UTest::sp_pstr = "pass";
|
|
const /*static*/ char * UTest::sp_fstr = "fail";
|
|
|
|
UTest::UTest( const char * tstr ) {
|
|
init(tstr);
|
|
}
|
|
|
|
void UTest::init( const char * tstr ) {
|
|
mp_tstr = tstr;
|
|
m_pass = m_fail = 0;
|
|
}
|
|
|
|
void UTest::test ( const char * description, const int flag ) {
|
|
const char * pf = nullptr;
|
|
if (flag) {
|
|
pf = sp_pstr;
|
|
++m_pass;
|
|
} else {
|
|
pf = sp_fstr;
|
|
++m_fail;
|
|
}
|
|
printf("%s: %s -> %s\n", mp_tstr, description, pf);
|
|
}
|
|
|
|
void UTest::report() const {
|
|
printf("%s: pass: %ld, fail: %ld\n", mp_tstr, m_pass, m_fail);
|
|
}
|
|
|