OLD | NEW |
(Empty) | |
| 1 # -*- coding: utf-8 -*- |
| 2 # |
| 3 # SelfTest/Random/OSRNG/__init__.py: Self-test for OSRNG modules |
| 4 # |
| 5 # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net> |
| 6 # |
| 7 # =================================================================== |
| 8 # The contents of this file are dedicated to the public domain. To |
| 9 # the extent that dedication to the public domain is not available, |
| 10 # everyone is granted a worldwide, perpetual, royalty-free, |
| 11 # non-exclusive license to exercise all rights associated with the |
| 12 # contents of this file for any purpose whatsoever. |
| 13 # No rights are reserved. |
| 14 # |
| 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 19 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 20 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 21 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 # SOFTWARE. |
| 23 # =================================================================== |
| 24 |
| 25 """Self-test for Crypto.Random.OSRNG package""" |
| 26 |
| 27 __revision__ = "$Id$" |
| 28 |
| 29 import os |
| 30 |
| 31 def get_tests(config={}): |
| 32 tests = [] |
| 33 if os.name == 'nt': |
| 34 from Crypto.SelfTest.Random.OSRNG import test_nt; tests += test_n
t.get_tests(config=config) |
| 35 from Crypto.SelfTest.Random.OSRNG import test_winrandom; tests += test_w
inrandom.get_tests(config=config) |
| 36 elif os.name == 'posix': |
| 37 from Crypto.SelfTest.Random.OSRNG import test_posix; tests += test_p
osix.get_tests(config=config) |
| 38 if hasattr(os, 'urandom'): |
| 39 from Crypto.SelfTest.Random.OSRNG import test_fallback; tests += te
st_fallback.get_tests(config=config) |
| 40 from Crypto.SelfTest.Random.OSRNG import test_generic; tests += test_g
eneric.get_tests(config=config) |
| 41 return tests |
| 42 |
| 43 if __name__ == '__main__': |
| 44 import unittest |
| 45 suite = lambda: unittest.TestSuite(get_tests()) |
| 46 unittest.main(defaultTest='suite') |
| 47 |
| 48 |
| 49 # vim:set ts=4 sw=4 sts=4 expandtab: |
OLD | NEW |