aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/run_tests.sh3
-rw-r--r--test/test.R7
-rw-r--r--test/test.py2
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)