Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
fx_random_unittest.cpp
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "core/fxcrt/fx_random.h"
6
7#include <array>
8#include <set>
9
10#include "testing/gtest/include/gtest/gtest.h"
11
13 // Prove this doesn't spin wait for a second each time.
14 // Since our global seeds are sequential, they wont't collide once
15 // seeded until 2^32 calls, and if the PNRG is any good, we won't
16 // get the same sequence from different seeds, esp. with this few
17 // iterations.
18 std::set<std::array<uint32_t, 16>> seen;
19 std::array<uint32_t, 16> current;
20 for (int i = 0; i < 3600; ++i) {
21 FX_Random_GenerateMT(current.data(), 16);
22 EXPECT_TRUE(seen.insert(current).second);
23 }
24}
TEST(FXCRYPT, MD5GenerateEmtpyData)