test: Fix shared random unit test for big endian
commitf46ce6e3d8bea3cf00388c87c29cdcafd4bab350
authorDavid Goulet <dgoulet@torproject.org>
Fri, 26 Aug 2016 15:06:09 +0000 (26 11:06 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Fri, 26 Aug 2016 18:46:29 +0000 (26 14:46 -0400)
treebab17085faa12ca1e7a667e1d1625dc546d8a53d
parent8fe410e875343a4c134ddbe0db6da3d38865deee
test: Fix shared random unit test for big endian

Copying the integer 42 in a char buffer has a different representation
depending on the endianess of the system thus that unit test was failing on
big endian system.

This commit introduces a python script, like the one we have for SRV, that
computes a COMMIT/REVEAL from scratch so we can use it as a test vector for
our encoding unit tests.

With this, we use a random value of bytes instead of a number fixing the
endianess issue and making the whole test case more solid with an external
tool that builds the COMMIT and REVEAL according to the spec.

Fixes #19977

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/19977 [new file with mode: 0644]
src/test/sr_commit_calc_ref.py [new file with mode: 0644]
src/test/test_shared_random.c