mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-22 09:30:32 +00:00
std::string_view rather than std::string reads a bit better for this use.
This commit is contained in:
parent
8e0092ec9d
commit
1796d62517
@ -48,7 +48,7 @@ void checker_t::dumpCycle(const cycle_t cycle) {
|
|||||||
dumpCycle(cycle.address(), cycle.value(), cycle.action());
|
dumpCycle(cycle.address(), cycle.value(), cycle.action());
|
||||||
}
|
}
|
||||||
|
|
||||||
void checker_t::raise(const std::string what, const uint16_t expected, const uint16_t actual) {
|
void checker_t::raise(std::string_view what, const uint16_t expected, const uint16_t actual) {
|
||||||
os()
|
os()
|
||||||
<< std::setw(2) << std::setfill(' ')
|
<< std::setw(2) << std::setfill(' ')
|
||||||
<< what
|
<< what
|
||||||
@ -58,7 +58,7 @@ void checker_t::raise(const std::string what, const uint16_t expected, const uin
|
|||||||
pushCurrentMessage();
|
pushCurrentMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checker_t::raise(const std::string what, const uint8_t expected, const uint8_t actual) {
|
void checker_t::raise(std::string_view what, const uint8_t expected, const uint8_t actual) {
|
||||||
os()
|
os()
|
||||||
<< std::setw(2) << std::setfill(' ')
|
<< std::setw(2) << std::setfill(' ')
|
||||||
<< what
|
<< what
|
||||||
@ -70,7 +70,7 @@ void checker_t::raise(const std::string what, const uint8_t expected, const uint
|
|||||||
pushCurrentMessage();
|
pushCurrentMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checker_t::raise(const std::string what, const std::string_view expected, const std::string_view actual) {
|
void checker_t::raise(std::string_view what, const std::string_view expected, const std::string_view actual) {
|
||||||
os()
|
os()
|
||||||
<< std::setw(0) << std::setfill(' ')
|
<< std::setw(0) << std::setfill(' ')
|
||||||
<< what
|
<< what
|
||||||
@ -79,7 +79,7 @@ void checker_t::raise(const std::string what, const std::string_view expected, c
|
|||||||
pushCurrentMessage();
|
pushCurrentMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checker_t::check(const std::string what, const uint16_t address, const uint8_t expected, const uint8_t actual) {
|
bool checker_t::check(std::string_view what, const uint16_t address, const uint8_t expected, const uint8_t actual) {
|
||||||
const auto success = actual == expected;
|
const auto success = actual == expected;
|
||||||
if (!success) {
|
if (!success) {
|
||||||
os() << what << ": " << std::setw(4) << std::setfill('0') << (int)address;
|
os() << what << ": " << std::setw(4) << std::setfill('0') << (int)address;
|
||||||
|
@ -42,19 +42,19 @@ private:
|
|||||||
|
|
||||||
void pushCurrentMessage();
|
void pushCurrentMessage();
|
||||||
|
|
||||||
void raise(std::string what, uint16_t expected, uint16_t actual);
|
void raise(std::string_view what, uint16_t expected, uint16_t actual);
|
||||||
void raise(std::string what, uint8_t expected, uint8_t actual);
|
void raise(std::string_view what, uint8_t expected, uint8_t actual);
|
||||||
void raise(std::string what, std::string_view expected, std::string_view actual);
|
void raise(std::string_view what, std::string_view expected, std::string_view actual);
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool check(std::string what, T expected, T actual) {
|
bool check(std::string_view what, T expected, T actual) {
|
||||||
const auto success = actual == expected;
|
const auto success = actual == expected;
|
||||||
if (!success)
|
if (!success)
|
||||||
raise(what, expected, actual);
|
raise(what, expected, actual);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check(std::string what, uint16_t address, uint8_t expected, uint8_t actual);
|
bool check(std::string_view what, uint16_t address, uint8_t expected, uint8_t actual);
|
||||||
|
|
||||||
void addActualCycle(uint16_t address, uint8_t value, std::string action);
|
void addActualCycle(uint16_t address, uint8_t value, std::string action);
|
||||||
void addActualCycle(EightBit::register16_t address, uint8_t value, std::string action);
|
void addActualCycle(EightBit::register16_t address, uint8_t value, std::string action);
|
||||||
|
Loading…
Reference in New Issue
Block a user