File: test-cpp.R

package info (click to toggle)
r-cran-dqrng 0.2.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 452 kB
  • sloc: cpp: 615; ansic: 154; sh: 14; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,124 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
41
42
43
context("C++")

Rcpp::sourceCpp("cpp/default.cpp")

seed <- 1234567890

test_that("consecutive calls yield different random numbers", {
  expect_false(consecutive_calls(seed))
})

test_that("setting seed produces identical uniformly distributed numbers", {
  expect_true(seed_uniform(seed))
})

test_that("setting seed produces identical uniformly distributed scalar numbers", {
  expect_true(seed_uniform_scalar(seed))
})

test_that("setting seed produces identical normaly distributed numbers", {
  expect_true(seed_normal(seed))
})

test_that("setting seed produces identical normaly distributed scalar numbers", {
  expect_true(seed_normal_scalar(seed))
})

test_that("setting seed produces identical exponenetially distributed numbers", {
  expect_true(seed_exponential(seed))
})

test_that("setting seed produces identical exponenetially distributed scalar numbers", {
  expect_true(seed_exponential_scalar(seed))
})

Rcpp::sourceCpp("cpp/xoshiro-jump.cpp")

test_that("jump() for xoroshiro128+ works", {
  expect_true(xoroshiro_jump())
})

test_that("jump() for xoshiro256+ works", {
  expect_true(xoshiro_jump())
})