From 222bcbeee5d64230a1f5d8276b6a9680bed99582 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 22 Jun 2018 14:09:49 +0200 Subject: [PATCH] Created unittest for iter_helpers --- test/test_iter_helpers.py | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 77 insertions(+), 0 deletions(-) create mode 100644 test/test_iter_helpers.py diff --git a/test/test_iter_helpers.py b/test/test_iter_helpers.py new file mode 100644 index 0000000..73bd8b8 --- /dev/null +++ b/test/test_iter_helpers.py @@ -0,0 +1,77 @@ +# The software in this package is distributed under the GNU General +# Public License version 2 (with a special exception described below). +# +# A copy of GNU General Public License (GPL) is included in this distribution, +# in the file COPYING.GPL. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file +# does not by itself cause the resulting work to be covered +# by the GNU General Public License. +# +# However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based +# on this file might be covered by the GNU General Public License. + +""" test_iter_helpers.py: unit tests for iter_helpers + +Tests classes and functions in iter_helpers + +Should be able run from python2 and python3! + +For help see :py:mod:`unittest` + +.. codeauthor:: Intra2net +""" + +from __future__ import print_function +from __future__ import absolute_import + +import unittest + +# relative import of tested module ensures we do not test installed version +from src import iter_helpers + + +class ModuleNameTester(unittest.TestCase): + """ only test case in this module, see module doc for more help """ + + def test_interesting_repetition(self): + """ tests interesting_repetition """ + self.assertTrue (iter_helpers.interesting_repetition(0)) + self.assertTrue (iter_helpers.interesting_repetition(1)) + self.assertTrue (iter_helpers.interesting_repetition(2)) + self.assertTrue (iter_helpers.interesting_repetition(3)) + self.assertFalse(iter_helpers.interesting_repetition(4)) + self.assertTrue (iter_helpers.interesting_repetition(5)) + self.assertFalse(iter_helpers.interesting_repetition(6)) + self.assertTrue (iter_helpers.interesting_repetition(7)) + self.assertFalse(iter_helpers.interesting_repetition(8)) + self.assertFalse(iter_helpers.interesting_repetition(9)) + self.assertTrue (iter_helpers.interesting_repetition(10)) + self.assertTrue (iter_helpers.interesting_repetition(11)) + self.assertTrue (iter_helpers.interesting_repetition(150)) + self.assertFalse(iter_helpers.interesting_repetition(151)) + self.assertTrue (iter_helpers.interesting_repetition(2000)) + self.assertFalse(iter_helpers.interesting_repetition(2001)) + self.assertTrue (iter_helpers.interesting_repetition(30000)) + self.assertFalse(iter_helpers.interesting_repetition(30001)) + self.assertTrue (iter_helpers.interesting_repetition(500000)) + self.assertFalse(iter_helpers.interesting_repetition(500001)) + self.assertTrue (iter_helpers.interesting_repetition(7500000)) + self.assertFalse(iter_helpers.interesting_repetition(7500001)) + self.assertTrue (iter_helpers.interesting_repetition(10000000)) + self.assertFalse(iter_helpers.interesting_repetition(10000001)) + self.assertTrue (iter_helpers.interesting_repetition(150000000)) + self.assertFalse(iter_helpers.interesting_repetition(150000001)) + self.assertTrue (iter_helpers.interesting_repetition(2000000000)) + self.assertFalse(iter_helpers.interesting_repetition(2000000001)) + self.assertTrue (iter_helpers.interesting_repetition(30000000000)) + self.assertFalse(iter_helpers.interesting_repetition(30000000001)) + + +if __name__ == '__main__': + unittest.main() -- 1.7.1