From 9bf33361a3457736885b6cb0490798c1f59d9fdf Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 11 Sep 2013 16:55:44 +0000
Subject: [PATCH] Add some regression tests for the random data

---
 setup/test/tests/test.crypto.php | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/setup/test/tests/test.crypto.php b/setup/test/tests/test.crypto.php
index e7274118e..3a6db8873 100644
--- a/setup/test/tests/test.crypto.php
+++ b/setup/test/tests/test.crypto.php
@@ -88,6 +88,15 @@ class TestCrypto extends Test {
         $c->setKeys($this->master, 'simple');
         $this->_testLibrary($c, $tests);
     }
+
+    function testRandom() {
+        for ($i=1; $i<128; $i+=4) {
+            $data = Crypto::random($i);
+            $this->assertNotEqual($data, '', 'Empty random data generated');
+            $this->assert(strlen($data) == $i,
+                'Random data received was not the length requested');
+        }
+    }
 }
 return 'TestCrypto';
 ?>
-- 
GitLab