diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-03-28 13:36:14 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-04-03 17:43:22 +0000 |
commit | 37d4a0b2ca1377268a82c085809edf63d19cc782 (patch) | |
tree | 9b0724cb55f479689cbc04c8b72f9bde99f775ab /auto_tests/tox_one_test.c | |
parent | 7fa0c89c96bdaf45bf202d770aa56dc7c68959b9 (diff) |
Avoid the use of rand() in tests.
We control the random functions in crypto_core, so we can make them
deterministic more easily. This will help test reproducibility in the
future.
Diffstat (limited to 'auto_tests/tox_one_test.c')
-rw-r--r-- | auto_tests/tox_one_test.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/auto_tests/tox_one_test.c b/auto_tests/tox_one_test.c index f3323bc9..48e2f791 100644 --- a/auto_tests/tox_one_test.c +++ b/auto_tests/tox_one_test.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <time.h> | 11 | #include <time.h> |
12 | 12 | ||
13 | #include "../toxcore/ccompat.h" | 13 | #include "../toxcore/ccompat.h" |
14 | #include "../toxcore/crypto_core.h" | ||
14 | #include "../toxcore/tox.h" | 15 | #include "../toxcore/tox.h" |
15 | #include "../toxcore/util.h" | 16 | #include "../toxcore/util.h" |
16 | 17 | ||
@@ -21,11 +22,11 @@ static void set_random_name_and_status_message(Tox *tox, uint8_t *name, uint8_t | |||
21 | int i; | 22 | int i; |
22 | 23 | ||
23 | for (i = 0; i < TOX_MAX_NAME_LENGTH; ++i) { | 24 | for (i = 0; i < TOX_MAX_NAME_LENGTH; ++i) { |
24 | name[i] = rand(); | 25 | name[i] = random_u08(); |
25 | } | 26 | } |
26 | 27 | ||
27 | for (i = 0; i < TOX_MAX_STATUS_MESSAGE_LENGTH; ++i) { | 28 | for (i = 0; i < TOX_MAX_STATUS_MESSAGE_LENGTH; ++i) { |
28 | status_message[i] = rand(); | 29 | status_message[i] = random_u08(); |
29 | } | 30 | } |
30 | } | 31 | } |
31 | 32 | ||