1 # The software in this package is distributed under the GNU General
2 # Public License version 2 (with a special exception described below).
4 # A copy of GNU General Public License (GPL) is included in this distribution,
5 # in the file COPYING.GPL.
7 # As a special exception, if other files instantiate templates or use macros
8 # or inline functions from this file, or you compile this file and link it
9 # with other works to produce a work based on this file, this file
10 # does not by itself cause the resulting work to be covered
11 # by the GNU General Public License.
13 # However the source code for this file must still be made available
14 # in accordance with section (3) of the GNU General Public License.
16 # This exception does not invalidate any other reasons why a work based
17 # on this file might be covered by the GNU General Public License.
19 """ test_iter_helpers.py: unit tests for iter_helpers
21 Tests classes and functions in iter_helpers
23 Should be able run from python2 and python3!
25 For help see :py:mod:`unittest`
27 .. codeauthor:: Intra2net
30 from __future__ import print_function
31 from __future__ import absolute_import
35 # relative import of tested module ensures we do not test installed version
36 from src import iter_helpers
39 class IterHelperTester(unittest.TestCase):
40 """ only test case in this module, see module doc for more help """
42 def test_interesting_repetition(self):
43 """ tests interesting_repetition """
44 self.assertTrue (iter_helpers.interesting_repetition(0))
45 self.assertTrue (iter_helpers.interesting_repetition(1))
46 self.assertTrue (iter_helpers.interesting_repetition(2))
47 self.assertTrue (iter_helpers.interesting_repetition(3))
48 self.assertFalse(iter_helpers.interesting_repetition(4))
49 self.assertTrue (iter_helpers.interesting_repetition(5))
50 self.assertFalse(iter_helpers.interesting_repetition(6))
51 self.assertTrue (iter_helpers.interesting_repetition(7))
52 self.assertFalse(iter_helpers.interesting_repetition(8))
53 self.assertFalse(iter_helpers.interesting_repetition(9))
54 self.assertTrue (iter_helpers.interesting_repetition(10))
55 self.assertFalse(iter_helpers.interesting_repetition(11))
56 self.assertTrue (iter_helpers.interesting_repetition(150))
57 self.assertFalse(iter_helpers.interesting_repetition(151))
58 self.assertTrue (iter_helpers.interesting_repetition(2000))
59 self.assertFalse(iter_helpers.interesting_repetition(2001))
60 self.assertTrue (iter_helpers.interesting_repetition(30000))
61 self.assertFalse(iter_helpers.interesting_repetition(30001))
62 self.assertTrue (iter_helpers.interesting_repetition(500000))
63 self.assertFalse(iter_helpers.interesting_repetition(500001))
64 self.assertTrue (iter_helpers.interesting_repetition(7500000))
65 self.assertFalse(iter_helpers.interesting_repetition(7500001))
66 self.assertTrue (iter_helpers.interesting_repetition(10000000))
67 self.assertFalse(iter_helpers.interesting_repetition(10000001))
68 self.assertTrue (iter_helpers.interesting_repetition(150000000))
69 self.assertFalse(iter_helpers.interesting_repetition(150000001))
70 self.assertTrue (iter_helpers.interesting_repetition(2000000000))
71 self.assertFalse(iter_helpers.interesting_repetition(2000000001))
72 self.assertTrue (iter_helpers.interesting_repetition(30000000000))
73 self.assertFalse(iter_helpers.interesting_repetition(30000000001))
76 if __name__ == '__main__':