diff options
| author | Gertjan van den Burg <burg@ese.eur.nl> | 2015-07-31 16:38:55 +0200 |
|---|---|---|
| committer | Gertjan van den Burg <burg@ese.eur.nl> | 2015-07-31 16:38:55 +0200 |
| commit | e5ad841afc8d7c6db4af3dc0de6206eb28472151 (patch) | |
| tree | f762a55b0e25f1119a0474fbe7d94d806ff9c844 | |
| parent | update R usage to use the SyncRNG library (diff) | |
| download | SyncRNG-e5ad841afc8d7c6db4af3dc0de6206eb28472151.tar.gz SyncRNG-e5ad841afc8d7c6db4af3dc0de6206eb28472151.zip | |
updated tests and added run_test script
| -rwxr-xr-x | test/run_tests.sh | 3 | ||||
| -rw-r--r-- | test/test.R | 7 | ||||
| -rw-r--r-- | test/test.py | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/test/run_tests.sh b/test/run_tests.sh new file mode 100755 index 0000000..4c7c5da --- /dev/null +++ b/test/run_tests.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +paste <(python test.py) <(Rscript test.R) diff --git a/test/test.R b/test/test.R index a94d47b..0937f52 100644 --- a/test/test.R +++ b/test/test.R @@ -1,5 +1,4 @@ - -source('./SyncRNG.R') +library(SyncRNG) test.randi <- function() { @@ -12,7 +11,7 @@ test.rand <- function() { s <- SyncRNG(seed=123456) for (i in 1:5) - cat(s$rand(), '\n') + cat(sprintf('%.16f\n', s$rand())) } test.randbelow <- function() @@ -29,7 +28,7 @@ test.shuffle <- function() for (i in 1:5) { y <- s$shuffle(x) x <- y - cat(y, '\n') + cat('[', paste(y, collapse=', '), ']\n', sep='') } } diff --git a/test/test.py b/test/test.py index ea0b79f..7d3f9f5 100644 --- a/test/test.py +++ b/test/test.py @@ -9,7 +9,7 @@ def test_randi(): def test_rand(): s = SyncRNG(seed=123456) for i in range(5): - print(s.rand()) + print('%.16f' % s.rand()) def test_randbelow(): s = SyncRNG(seed=123456) |
