mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-01 11:29:17 +00:00
Clarify some (no) exception specifications.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
f62e8c30a2
commit
357e51c09a
@ -149,8 +149,8 @@ bool TestRunner::checkState() {
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < expected_cycles.size(); ++i) {
|
||||
const auto& expected = expected_cycles.at(i);
|
||||
const auto& actual = actual_cycles.at(i); // actual could be less than expected
|
||||
const auto& expected = expected_cycles[i];
|
||||
const auto& actual = actual_cycles[i]; // actual could be less than expected
|
||||
check("Cycle address", expected.address(), actual.address());
|
||||
check("Cycle value", expected.value(), actual.value());
|
||||
check("Cycle action", expected.action(), actual.action());
|
||||
|
@ -4,38 +4,33 @@
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
|
||||
cycle_t::action_t cycle_t::to_action(std::string value) {
|
||||
cycle_t::action_t cycle_t::to_action(std::string value) noexcept {
|
||||
if (value == "read")
|
||||
return action_t::read;
|
||||
if (value == "write")
|
||||
return action_t::write;
|
||||
throw new std::out_of_range("Unknown action");
|
||||
return action_t::unknown;
|
||||
}
|
||||
|
||||
std::string cycle_t::to_string(action_t value) {
|
||||
std::string cycle_t::to_string(action_t value) noexcept {
|
||||
if (value == action_t::read)
|
||||
return "read";
|
||||
if (value == action_t::write)
|
||||
return "write";
|
||||
throw new std::out_of_range("Unknown action");
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
cycle_t::cycle_t(uint16_t address, uint8_t value, action_t action)
|
||||
cycle_t::cycle_t(uint16_t address, uint8_t value, action_t action) noexcept
|
||||
: m_address(address),
|
||||
m_value(value),
|
||||
m_action(action) {}
|
||||
|
||||
cycle_t::cycle_t(uint16_t address, uint8_t value, std::string action)
|
||||
: m_address(address),
|
||||
m_value(value),
|
||||
m_action(to_action(action)) {}
|
||||
|
||||
#ifdef USE_SIMDJSON_JSON
|
||||
|
||||
cycle_t::cycle_t(simdjson::dom::element input)
|
||||
cycle_t::cycle_t(simdjson::dom::element input) noexcept
|
||||
: cycle_t(input.get_array()) {}
|
||||
|
||||
cycle_t::cycle_t(simdjson::dom::array input)
|
||||
cycle_t::cycle_t(simdjson::dom::array input) noexcept
|
||||
: m_address((uint16_t)(uint64_t)input.at(0)),
|
||||
m_value((uint8_t)(uint64_t)input.at(1)),
|
||||
m_action(to_action((std::string)input.at(2))) {
|
||||
|
@ -29,15 +29,14 @@ private:
|
||||
action_t m_action = action_t::unknown;
|
||||
|
||||
public:
|
||||
[[nodiscard]] static action_t to_action(std::string value);
|
||||
[[nodiscard]] static std::string to_string(action_t value);
|
||||
[[nodiscard]] static std::string to_string(action_t value) noexcept;
|
||||
[[nodiscard]] static action_t to_action(std::string value) noexcept;
|
||||
|
||||
cycle_t(uint16_t address, uint8_t value, action_t action);
|
||||
cycle_t(uint16_t address, uint8_t value, std::string action);
|
||||
cycle_t(uint16_t address, uint8_t value, action_t action) noexcept;
|
||||
|
||||
#ifdef USE_SIMDJSON_JSON
|
||||
cycle_t(simdjson::dom::element input);
|
||||
cycle_t(simdjson::dom::array input);
|
||||
cycle_t(simdjson::dom::element input) noexcept;
|
||||
cycle_t(simdjson::dom::array input) noexcept;
|
||||
#endif
|
||||
|
||||
#ifdef USE_BOOST_JSON
|
||||
|
@ -53,6 +53,6 @@ public:
|
||||
|
||||
void clear() { m_cycles.clear(); }
|
||||
|
||||
[[nodiscard]] auto& at(size_t idx) { return m_cycles.at(idx); }
|
||||
[[nodiscard]] const auto& at(size_t idx) const { return m_cycles.at(idx); }
|
||||
[[nodiscard]] auto& operator[](size_t idx) noexcept { return m_cycles[idx]; }
|
||||
[[nodiscard]] const auto& operator[](size_t idx) const noexcept { return m_cycles[idx]; }
|
||||
};
|
||||
|
@ -42,13 +42,13 @@ public:
|
||||
ram_t(const Json::Value& input);
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto begin() const { return m_bytes.begin(); }
|
||||
[[nodiscard]] auto end() const { return m_bytes.end(); }
|
||||
[[nodiscard]] auto begin() const noexcept { return m_bytes.begin(); }
|
||||
[[nodiscard]] auto end() const noexcept { return m_bytes.end(); }
|
||||
|
||||
[[nodiscard]] auto size() const noexcept { return m_bytes.size(); }
|
||||
|
||||
void clear() { m_bytes.clear(); }
|
||||
void clear() noexcept { m_bytes.clear(); }
|
||||
|
||||
[[nodiscard]] auto& at(size_t idx) { return m_bytes.at(idx); }
|
||||
[[nodiscard]] const auto& at(size_t idx) const { return m_bytes.at(idx); }
|
||||
[[nodiscard]] auto& operator[](size_t idx) noexcept { return m_bytes[idx]; }
|
||||
[[nodiscard]] const auto& operator[](size_t idx) const noexcept { return m_bytes[idx]; }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user