diff options
author | Klap-in <klapinklapin@gmail.com> | 2013-08-01 23:06:36 +0200 |
---|---|---|
committer | Klap-in <klapinklapin@gmail.com> | 2013-08-01 23:06:36 +0200 |
commit | de489e8bb4161522864aca1d308b9910387ae4bb (patch) | |
tree | 697a6ca1a6a3341598a6272dca6e5cf0ee4cd105 /_test/tests/inc/auth_random.test.php | |
parent | cc036f74ff14c387f24d72f5a52f2f158208846e (diff) | |
parent | 4fb6e51447e840624b59742bec61641d606f5006 (diff) | |
download | rpg-de489e8bb4161522864aca1d308b9910387ae4bb.tar.gz rpg-de489e8bb4161522864aca1d308b9910387ae4bb.tar.bz2 |
Merge remote-tracking branch 'origin/master' into fetchimagetokexternal
Diffstat (limited to '_test/tests/inc/auth_random.test.php')
-rw-r--r-- | _test/tests/inc/auth_random.test.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/_test/tests/inc/auth_random.test.php b/_test/tests/inc/auth_random.test.php new file mode 100644 index 000000000..f380eba53 --- /dev/null +++ b/_test/tests/inc/auth_random.test.php @@ -0,0 +1,20 @@ +<?php + +/** + * Tests the random generator functions + */ +class auth_random_test extends DokuWikiTest { + function testRandomRange() { + $rand = auth_random(300, 2000); + $this->assertTrue($rand <= 2000, 'The generated number was above the limit'); + $this->assertTrue($rand >= 300, 'The generate number was too low'); + } + + function testLargeRandoms() { + $min = (1 << 30); + $max = $min + (1 << 33) + 17; + $rand = auth_random($min, $max); + $this->assertTrue($rand >= $min, 'The generated number was too low'); + $this->assertTrue($rand <= $max, 'The generated number was too high'); + } +} |