crc: Clean up interface to work with unsigned types

Addresses: #5
This commit is contained in:
Vladimir Petrigo
2023-09-28 23:49:11 +06:00
parent 990cb648f3
commit baea283a3d
15 changed files with 60 additions and 48 deletions
+12 -9
View File
@@ -1,12 +1,9 @@
#include "test_harness.h"
#include <string>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <vector>
#include <string>
#include <cstring>
#include <ctime>
namespace common {
namespace test {
@@ -80,9 +77,15 @@ namespace common {
startMs_, endMs, endMs - startMs_);
}
long TestPerfomence::NowMs() {
struct timeval timeNow;
gettimeofday(&timeNow, NULL);
return (timeNow.tv_sec) * 1000 + timeNow.tv_usec / 1000;
timespec timeNow{};
if (timespec_get(&timeNow, TIME_UTC) != TIME_UTC)
{
fputs("timespec_get failed!", stderr);
return 0;
}
return static_cast<long>(timeNow.tv_sec * 1000 + timeNow.tv_nsec / 1000);
}
}
+2 -2
View File
@@ -48,7 +48,7 @@ class Tester {
fname_, line_, ss_.str().c_str());
fprintf(stderr, "\033[0m");
errCount++;
//exit(1);
exit(1);
}
}
@@ -64,7 +64,7 @@ class Tester {
template <class X, class Y> \
Tester& name(const X& x, const Y& y) { \
if (! (x op y)) { \
ss_ << " failed: Expect:" << x << (" " #op " ") << "Actual:" << y; \
ss_ << " failed: Expect:" << std::hex << uint64_t {x} << (" " #op " ") << "Actual:" << std::hex << uint64_t {y}; \
ok_ = false; \
} \
return *this; \