summaryrefslogtreecommitdiff
path: root/auto_tests/save_friend_test.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-03-28 13:36:14 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-04-03 17:43:22 +0000
commit37d4a0b2ca1377268a82c085809edf63d19cc782 (patch)
tree9b0724cb55f479689cbc04c8b72f9bde99f775ab /auto_tests/save_friend_test.c
parent7fa0c89c96bdaf45bf202d770aa56dc7c68959b9 (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/save_friend_test.c')
-rw-r--r--auto_tests/save_friend_test.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/auto_tests/save_friend_test.c b/auto_tests/save_friend_test.c
index a7b41f52..1e90e692 100644
--- a/auto_tests/save_friend_test.c
+++ b/auto_tests/save_friend_test.c
@@ -7,6 +7,7 @@
7 7
8#include "helpers.h" 8#include "helpers.h"
9#include "../toxcore/ccompat.h" 9#include "../toxcore/ccompat.h"
10#include "../toxcore/crypto_core.h"
10#include "../toxcore/tox.h" 11#include "../toxcore/tox.h"
11 12
12#include <assert.h> 13#include <assert.h>
@@ -27,7 +28,7 @@ static void set_random(Tox *m, bool (*setter)(Tox *, const uint8_t *, size_t, TO
27 uint32_t i; 28 uint32_t i;
28 29
29 for (i = 0; i < length; ++i) { 30 for (i = 0; i < length; ++i) {
30 text[i] = rand(); 31 text[i] = random_u08();
31 } 32 }
32 33
33 setter(m, text, SIZEOF_VLA(text), nullptr); 34 setter(m, text, SIZEOF_VLA(text), nullptr);