summaryrefslogtreecommitdiffstats
path: root/util/random/entropy_ut.cpp
blob: 072060b2ac2444989959267c9f402f585a55ea14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "entropy.h"

#include <library/cpp/testing/common/env.h>
#include <library/cpp/testing/unittest/registar.h>
#include <util/folder/tempdir.h>
#include <util/system/fs.h>

Y_UNIT_TEST_SUITE(TestEntropy) {
    Y_UNIT_TEST(TestSeed) {
        char buf[100];

        for (size_t i = 0; i < sizeof(buf); ++i) {
            Seed().LoadOrFail(buf, i);
        }
    }

    Y_UNIT_TEST(TestReset) {
        UNIT_ASSERT_NO_EXCEPTION(ResetEntropyPool());
    }

#if !defined(_win_)
    Y_UNIT_TEST(TestMissingWorkingDirectory) {
        NFs::SetCurrentWorkingDirectory(TTempDir::NewTempDir(GetWorkPath()).Name());
        UNIT_ASSERT_NO_EXCEPTION(ResetEntropyPool());
    }
#endif

} // Y_UNIT_TEST_SUITE(TestEntropy)