blob: c0282437e2e1d5f29787f9019c271933dcacd1dd (
plain)
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
29
30
31
|
//===- lld/unittest/ParallelTest.cpp --------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Parallel.h unit tests.
///
//===----------------------------------------------------------------------===//
#include "gtest/gtest.h"
#include "lld/Core/Parallel.h"
#include <array>
#include <random>
uint32_t array[1024 * 1024];
TEST(Parallel, sort) {
std::mt19937 randEngine;
std::uniform_int_distribution<uint32_t> dist;
for (auto &i : array)
i = dist(randEngine);
lld::parallel_sort(std::begin(array), std::end(array));
ASSERT_TRUE(std::is_sorted(std::begin(array), std::end(array)));
}
|