|
1 | | -if (hasAtomicSupport()) { |
| 1 | +if (RcppThread:::hasAtomicSupport()) { |
2 | 2 |
|
3 | | -context("Compile test functions") |
4 | | -Rcpp::sourceCpp(file = normalizePath("../tests.cpp")) |
| 3 | + context("Compile test functions") |
| 4 | + Rcpp::sourceCpp(file = normalizePath("../tests.cpp")) |
5 | 5 |
|
6 | | -runs <- 10 |
7 | | -for (run in seq_len(runs)) { |
8 | | - context(paste0("---------------------------- run ", run, "/", runs)) |
9 | | - test_that("start", expect_true(TRUE)) |
| 6 | + runs <- 10 |
| 7 | + for (run in seq_len(runs)) { |
| 8 | + context(paste0("---------------------------- run ", run, "/", runs)) |
| 9 | + test_that("start", expect_true(TRUE)) |
10 | 10 |
|
11 | | - ## ------------------------------------------------------- |
12 | | - context("R-monitor") |
13 | | - test_that("R-monitor works", { |
14 | | - expect_output(testMonitor(), "RcppThread says hi!", fixed = TRUE) |
15 | | - }) |
| 11 | + ## ------------------------------------------------------- |
| 12 | + context("R-monitor") |
| 13 | + test_that("R-monitor works", { |
| 14 | + expect_output(testMonitor(), "RcppThread says hi!", fixed = TRUE) |
| 15 | + }) |
16 | 16 |
|
17 | 17 |
|
18 | | - ## ------------------------------------------------------- |
19 | | - context("Thread class") |
20 | | - test_that("Thread class works", { |
21 | | - expect_output(testThreadClass()) |
22 | | - }) |
| 18 | + ## ------------------------------------------------------- |
| 19 | + context("Thread class") |
| 20 | + test_that("Thread class works", { |
| 21 | + expect_output(testThreadClass()) |
| 22 | + }) |
23 | 23 |
|
24 | 24 |
|
25 | | - ## ------------------------------------------------------- |
26 | | - context("Thread pool") |
| 25 | + ## ------------------------------------------------------- |
| 26 | + context("Thread pool") |
27 | 27 |
|
28 | | - test_that("push works", { |
29 | | - testThreadPoolPush() |
30 | | - expect_silent(testThreadPoolPush()) |
31 | | - }) |
| 28 | + test_that("push works", { |
| 29 | + testThreadPoolPush() |
| 30 | + expect_silent(testThreadPoolPush()) |
| 31 | + }) |
32 | 32 |
|
33 | | - test_that("pushReturn works", { |
34 | | - expect_silent(testThreadPoolPushReturn()) |
35 | | - }) |
| 33 | + test_that("pushReturn works", { |
| 34 | + expect_silent(testThreadPoolPushReturn()) |
| 35 | + }) |
36 | 36 |
|
37 | | - test_that("map works", { |
38 | | - expect_silent(testThreadPoolMap()) |
39 | | - }) |
| 37 | + test_that("map works", { |
| 38 | + expect_silent(testThreadPoolMap()) |
| 39 | + }) |
40 | 40 |
|
41 | | - test_that("parallelFor works", { |
42 | | - expect_silent(testThreadPoolParallelFor()) |
43 | | - }) |
| 41 | + test_that("parallelFor works", { |
| 42 | + expect_silent(testThreadPoolParallelFor()) |
| 43 | + }) |
44 | 44 |
|
45 | | - test_that("nested parallelFor works", { |
46 | | - expect_silent(testThreadPoolNestedParallelFor()) |
47 | | - }) |
| 45 | + test_that("nested parallelFor works", { |
| 46 | + expect_silent(testThreadPoolNestedParallelFor()) |
| 47 | + }) |
48 | 48 |
|
49 | | - test_that("parallelForEach works", { |
50 | | - expect_silent(testThreadPoolParallelForEach()) |
51 | | - }) |
| 49 | + test_that("parallelForEach works", { |
| 50 | + expect_silent(testThreadPoolParallelForEach()) |
| 51 | + }) |
52 | 52 |
|
53 | | - test_that("nested parallelForEach works", { |
54 | | - expect_silent(testThreadPoolNestedParallelForEach()) |
55 | | - }) |
| 53 | + test_that("nested parallelForEach works", { |
| 54 | + expect_silent(testThreadPoolNestedParallelForEach()) |
| 55 | + }) |
56 | 56 |
|
57 | | - test_that("works single threaded", { |
58 | | - expect_silent(testThreadPoolSingleThreaded()) |
59 | | - }) |
| 57 | + test_that("works single threaded", { |
| 58 | + expect_silent(testThreadPoolSingleThreaded()) |
| 59 | + }) |
60 | 60 |
|
61 | | - test_that("destructible without join", { |
62 | | - expect_silent(testThreadPoolDestructWOJoin()) |
63 | | - }) |
| 61 | + test_that("destructible without join", { |
| 62 | + expect_silent(testThreadPoolDestructWOJoin()) |
| 63 | + }) |
64 | 64 |
|
65 | | - # test_that("rethrows exceptions", { |
66 | | - # expect_silent(testThreadPoolExceptionHandling()) |
67 | | - # }) |
| 65 | + # test_that("rethrows exceptions", { |
| 66 | + # expect_silent(testThreadPoolExceptionHandling()) |
| 67 | + # }) |
68 | 68 |
|
69 | | - ## ------------------------------------------------------- |
70 | | - context("Parallel for functions") |
| 69 | + ## ------------------------------------------------------- |
| 70 | + context("Parallel for functions") |
71 | 71 |
|
72 | | - test_that("parallelFor works", { |
73 | | - expect_silent(testParallelFor()) |
74 | | - }) |
| 72 | + test_that("parallelFor works", { |
| 73 | + expect_silent(testParallelFor()) |
| 74 | + }) |
75 | 75 |
|
76 | | - test_that("nested parallelFor works", { |
77 | | - expect_silent(testNestedParallelFor()) |
78 | | - }) |
| 76 | + test_that("nested parallelFor works", { |
| 77 | + expect_silent(testNestedParallelFor()) |
| 78 | + }) |
79 | 79 |
|
80 | | - test_that("parallelForEach works", { |
81 | | - expect_silent(testParallelForEach()) |
82 | | - }) |
| 80 | + test_that("parallelForEach works", { |
| 81 | + expect_silent(testParallelForEach()) |
| 82 | + }) |
83 | 83 |
|
84 | | - test_that("nested parallelForEach works", { |
85 | | - expect_silent(testNestedParallelForEach()) |
86 | | - }) |
| 84 | + test_that("nested parallelForEach works", { |
| 85 | + expect_silent(testNestedParallelForEach()) |
| 86 | + }) |
87 | 87 |
|
88 | | - # ------------------------------------------------------ |
89 | | - context("Progress tracking") |
90 | | - test_that("ProgressCounter works", { |
91 | | - expect_output(testProgressCounter(), "100% \\(done\\)") |
92 | | - }) |
| 88 | + # ------------------------------------------------------ |
| 89 | + context("Progress tracking") |
| 90 | + test_that("ProgressCounter works", { |
| 91 | + expect_output(testProgressCounter(), "100% \\(done\\)") |
| 92 | + }) |
93 | 93 |
|
94 | | - test_that("ProgressBar works", { |
95 | | - expect_output(testProgressBar(), "100% \\(done\\)") |
96 | | - }) |
97 | | -} |
| 94 | + test_that("ProgressBar works", { |
| 95 | + expect_output(testProgressBar(), "100% \\(done\\)") |
| 96 | + }) |
| 97 | + } |
98 | 98 |
|
99 | 99 | } |
0 commit comments