2022-02-16 00:53:01 -05:00
|
|
|
|
#include "stdafx.h"
|
2023-10-18 06:23:55 -04:00
|
|
|
|
//#include <wx/webview.h>
|
2022-02-16 00:53:01 -05:00
|
|
|
|
//#include <mbctype.h>
|
|
|
|
|
|
2022-03-07 23:46:14 -05:00
|
|
|
|
/* Any code here can be deleted at will without impact on the
|
2022-02-16 00:53:01 -05:00
|
|
|
|
functioning of the program.
|
|
|
|
|
|
|
|
|
|
This routine gets called during every unit test, and can log its results
|
|
|
|
|
to the log window. It should normally do absolutely nothing,
|
|
|
|
|
because useful working code should be moved the appropriate
|
|
|
|
|
files, and broken code should be thrown away
|
|
|
|
|
|
2022-03-07 23:46:14 -05:00
|
|
|
|
Anything here is a residue of forgotten experiments, and can safely
|
2022-02-16 00:53:01 -05:00
|
|
|
|
be thrown away. If any experiments have value, they will be
|
|
|
|
|
have been recorded in git. Nothing here is needed. If it was
|
|
|
|
|
needed, would have been moved.
|
|
|
|
|
|
2022-03-07 23:46:14 -05:00
|
|
|
|
Namespace testbed is only defined in this cpp file, hence nothing within
|
|
|
|
|
this namespace can be accessed from anywhere else.
|
|
|
|
|
except the routine testbed
|
|
|
|
|
|
|
|
|
|
If it needs to interact with the outside world, should post a message
|
2022-02-16 00:53:01 -05:00
|
|
|
|
analogously to queue_error_message, which then calls back to a
|
|
|
|
|
routine in this file.*/
|
2022-06-12 03:38:26 -04:00
|
|
|
|
void ascii2test();
|
|
|
|
|
extern const uint8_t* const ascii2six;
|
2022-02-16 00:53:01 -05:00
|
|
|
|
|
|
|
|
|
namespace testbed {
|
2023-10-18 06:23:55 -04:00
|
|
|
|
using ristretto255::hash, ristretto255::hsh, ristretto255::scalar,
|
2022-03-07 23:46:14 -05:00
|
|
|
|
ristretto255::point, ro::serialize, ro::bin2hex, ro::hex2bin,
|
2023-09-24 01:21:18 -04:00
|
|
|
|
ro::bin2hex, ro::fasthash, ro::CompileSizedString,
|
2023-09-30 01:13:25 -04:00
|
|
|
|
ro::base58, ro::has_machine_independent_representation;
|
2023-09-23 01:58:56 -04:00
|
|
|
|
static constexpr char SrcFilename[]{ "src/testbed.cpp" };
|
2022-02-16 00:53:01 -05:00
|
|
|
|
|
2023-09-24 01:21:18 -04:00
|
|
|
|
|
2022-03-07 23:46:14 -05:00
|
|
|
|
/* experimental code called during unit test
|
|
|
|
|
Anything here is a residue of forgotten experiments,
|
2022-02-16 00:53:01 -05:00
|
|
|
|
and can safely be thrown away
|
|
|
|
|
|
2022-03-07 23:46:14 -05:00
|
|
|
|
This is a playground, where you can do stuff without worrying you might
|
|
|
|
|
inadvertently break something that matters
|
|
|
|
|
|
2023-09-23 01:58:56 -04:00
|
|
|
|
Output goes to the unit test log.
|
2022-03-07 23:46:14 -05:00
|
|
|
|
|
2023-09-23 01:58:56 -04:00
|
|
|
|
No mechanism for input is available. You generally do not need it
|
|
|
|
|
because you hard code the testing data, and detect errors with
|
|
|
|
|
asserts, rather than exceptions but, of course, it can post a
|
|
|
|
|
dialog using postmessage, and the dialog can then call anything.
|
2022-02-23 04:21:31 -05:00
|
|
|
|
|
2023-09-23 01:58:56 -04:00
|
|
|
|
Uncaught exceptions result in unit test failure, and an error message
|
|
|
|
|
at the end of the unit test, but not in an error message in the
|
|
|
|
|
main program UI.
|
|
|
|
|
|
|
|
|
|
If using postmessage, execution of the code waits for the dialog to
|
|
|
|
|
return, data from the dialog can be used in the testbed code, and
|
|
|
|
|
uncaught exceptions in the dialog will result unit test failure
|
|
|
|
|
and be reported in the unit test log.
|
|
|
|
|
|
|
|
|
|
If using queumessage, the testbed code will complete while the dialog
|
2023-09-24 01:21:18 -04:00
|
|
|
|
is waiting, data cannot be returned for use in the testbed code,
|
|
|
|
|
and uncaught exceptions in the dialog queued will appear in the main UI.
|
2022-02-16 00:53:01 -05:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void testbed() {
|
2023-10-18 06:23:55 -04:00
|
|
|
|
hsh a_hsh=hsh().hashinto("the quick brown fox", "jumped over the lazy dog");
|
|
|
|
|
hash<256> a_hash = a_hsh;
|
|
|
|
|
// wxVersionInfo wx = wxWebView::GetBackendVersionInfo(wxASCII_STR(wxWebViewBackendDefault));
|
|
|
|
|
// wxLogMessage(wx.ToString());
|
|
|
|
|
// wx = wxWebView::GetBackendVersionInfo(wxASCII_STR(wxWebViewBackendEdge));
|
|
|
|
|
// wxLogMessage(wx.ToString());
|
2023-09-23 01:58:56 -04:00
|
|
|
|
// queue_error_message("hello world");
|
|
|
|
|
// throw MyException("hello world exception", __LINE__, __func__, SrcFilename);
|
2022-02-16 00:53:01 -05:00
|
|
|
|
}
|
|
|
|
|
}
|