diff --git a/app.h b/app.h index 4ec8189..69e26bd 100644 --- a/app.h +++ b/app.h @@ -47,7 +47,7 @@ static constexpr wxCmdLineEntryDesc g_cmdLineDesc[] = "If the log is displayed, then does not exit on completion of unit test.", wxCMD_LINE_VAL_NONE, wxCMD_LINE_SWITCH_NEGATABLE}, { wxCMD_LINE_SWITCH, "f", "focus", "-f or --focus causes focus events to be logged for debugging purposes. " - "Usually used as -lf or -lft, as logging them without displaying them is useless.", + "implies log", wxCMD_LINE_VAL_NONE, wxCMD_LINE_SWITCH_NEGATABLE}, { wxCMD_LINE_PARAM, "", "", "mywallet.wallet", wxCMD_LINE_VAL_NONE, /*wxCMD_LINE_PARAM_MULTIPLE|*/wxCMD_LINE_PARAM_OPTIONAL}, diff --git a/frame.cpp b/frame.cpp index ca6bd30..aa0785e 100644 --- a/frame.cpp +++ b/frame.cpp @@ -83,10 +83,12 @@ try { m_pLogWindow->GetFrame()->SetName(sz_unit_test_log); m_pLogWindow->GetFrame()->SetIcon(wxICON(AAArho)); if (singletonApp->m_unit_test) { - wxLogMessage(_T("Command line specified unit test with%s exit on completion of unit test."), + wxLogMessage(_T("Command line specified %s unit test with%s exit on completion of unit test."), + singletonApp->m_complete_unit_test?_T("complete"): singletonApp->m_quick_unit_test?_T("quick"):_T(""), singletonApp->m_display ? _T("out") : _T("")); wxLogMessage(_T("If an error occurs during unit test, the program will return a non zero " "error number on exit.")); + wxLogMessage(_T("")); } }else { wxLog::EnableLogging(false); @@ -97,7 +99,10 @@ try { wxEVT_IDLE, &UnitTest ); - if (singletonApp->m_log_focus_events)wxLogMessage(_T("Logging focus events")); + if (singletonApp->m_log_focus_events) { + wxLogMessage(_T("Logging focus events")); + wxLogMessage(_T("")); + } if (singletonApp->m_params.empty()) { wxLogMessage(_T("No wallet specified. Attempting to open last used wallet")); }else { diff --git a/introspection_of_standard_C_types.h b/introspection_of_standard_C_types.h index a6f5498..a08edcf 100644 --- a/introspection_of_standard_C_types.h +++ b/introspection_of_standard_C_types.h @@ -59,7 +59,61 @@ namespace ro { junction...>::value; } -std::span& operator^=(std::span& lhs, byte* rhs) { - for (auto& j : lhs) { j ^= *rhs++; } - return lhs; +/*spaceship operator for any pair of types that take an index + * + * noexistent values of the shorter array are considered zero if of + * arithmetic type, otherwise, considered greater than zero */ +template +decltype(std::declval()[0] <=> std::declval()[0]) operator <=> ( + const T& lh, const U& rh + ) { + typedef decltype(lh[0] <=> rh[0]) spaceship_return_type; + auto slh{ std::span(lh) }; + auto srh{ std::span(rh) }; + auto minsize{ std::min(slh.size(), srh.size()) }; + spaceship_return_type retval{ spaceship_return_type::equivalent }; + auto plh{ slh.begin() }; + auto prh{ srh.begin() }; + auto common_end{ plh + minsize }; + while ( + plh < common_end + && + ( + std::is_eq(retval = plh[0] <=> prh[0]) + ) + ) { + plh++; + prh++; + } + if (std::is_eq(retval)) { + if (slh.size() > srh.size()) { + assert(prh == srh.end() && plh < slh.end()); + if constexpr (std::is_arithmetic()[0])>::type>::value) { + while ( + plh < slh.end() + && std::is_eq(retval = plh[0] <=> 0) + ) { + plh++; + } + } + else { + retval = spaceship_return_type::greater; + } + } + if (slh.size() < srh.size()) { + assert(plh == slh.end() && prh < srh.end()); + if constexpr (std::is_arithmetic()[0])>::type>::value) { + while ( + prh < srh.end() + && std::is_eq(retval = prh[0] <=> 0) + ) { + prh++; + } + } + else { + retval = spaceship_return_type::less; + } + } + } + return retval; } \ No newline at end of file diff --git a/testbed.cpp b/testbed.cpp index b11fd6e..688debe 100644 --- a/testbed.cpp +++ b/testbed.cpp @@ -26,6 +26,8 @@ namespace testbed { and can safely be thrown away This is a playground, where you can do stuff without worrying you might inadvertently break something that matters + + No mechanism for input is available, but you generally do not need it because you hard code the testing data, but, of course, it can post a dialog using postmessage, then immediately return, and the dialog can then call anything. */ void testbed() {