diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-11-23 23:31:36 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-12-27 02:30:45 +0100 |
| commit | b318ce46f90b4f99f08749df8540f58b74962bee (patch) | |
| tree | 9b046bb3978e04fb788c92a14b5d7aa77327ebe1 /src/KM_util.cpp | |
| parent | a86a6cf14b3966348f4ea08571aacbba4e54013c (diff) | |
Allow predictable random number and date generation during testing.
Diffstat (limited to 'src/KM_util.cpp')
| -rwxr-xr-x | src/KM_util.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/KM_util.cpp b/src/KM_util.cpp index da8d732..6d364cc 100755 --- a/src/KM_util.cpp +++ b/src/KM_util.cpp @@ -40,6 +40,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <map> #include <string> +bool Kumu::cth_test = false; + const char* Kumu::Version() { @@ -589,6 +591,13 @@ Kumu::GenRandomValue(UUID& ID) ID.Set(tmp_buf); } +void +Kumu::ResetTestRNG() +{ + FortunaRNG RNG; + RNG.Reset(); +} + // void Kumu::GenRandomUUID(byte_t* buf) @@ -745,7 +754,14 @@ Kumu::write_BER(byte_t* buf, ui64_t val, ui32_t ber_len) // Kumu::Timestamp::Timestamp() : m_TZOffsetMinutes(0) { - m_Timestamp.now(); + if (cth_test) + { + m_Timestamp.x = 42; + } + else + { + m_Timestamp.now(); + } } Kumu::Timestamp::Timestamp(const Timestamp& rhs) { |
