Page MenuHomePhabricator

tests: add LCG pseudorandom module
ClosedPublic

Authored by markblundeberg on Feb 1 2019, 18:29.

Details

Summary

(to be used by: sigencoding_tests and radix_tests)

Test Plan

run test_bitcoin

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markblundeberg created this revision.Feb 1 2019, 18:29
Herald added a reviewer: Restricted Project. · View Herald TranscriptFeb 1 2019, 18:29
Herald added a subscriber: schancel. · View Herald Transcript
deadalnix requested changes to this revision.Feb 1 2019, 20:59
deadalnix added inline comments.
src/Makefile.test.include
68 ↗(On Diff #7098)

You need to add the .h here

src/test/lcg.h
15 ↗(On Diff #7098)

The return value is invalid. Only the upper 32 bits are pseudo random.

20 ↗(On Diff #7098)

Constructor goes first.

src/test/lcg_tests.cpp
10 ↗(On Diff #7098)

remove

11 ↗(On Diff #7098)

You may want to start several starting values.

This revision now requires changes to proceed.Feb 1 2019, 20:59
markblundeberg updated this revision to Diff 7105.Feb 1 2019, 22:22

changed to return 32bit; expand attribution & explanation; more tests

markblundeberg marked 5 inline comments as done.Feb 1 2019, 22:23
deadalnix requested changes to this revision.Feb 1 2019, 22:26

Mostly small changes. It's looking good overall.

src/Makefile.test.include
69 ↗(On Diff #7105)

cpp before h

src/test/lcg.h
23 ↗(On Diff #7105)

You can compute the return value directly here.

24 ↗(On Diff #7105)

and just use state here :)

src/test/lcg_tests.cpp
14 ↗(On Diff #7105)

BOOST_CHECK_EQUAL

This revision now requires changes to proceed.Feb 1 2019, 22:26
markblundeberg updated this revision to Diff 7106.Feb 1 2019, 22:36

changed name; misc comments from amaury

deadalnix accepted this revision.Feb 1 2019, 22:37
This revision is now accepted and ready to land.Feb 1 2019, 22:37
This revision was automatically updated to reflect the committed changes.