Coverage for tests/stats/test_acovf.py: 100%
6 statements
« prev ^ index » next coverage.py v7.3.2, created at 2024-02-28 12:51 +1100
« prev ^ index » next coverage.py v7.3.2, created at 2024-02-28 12:51 +1100
1"""
3This module contains unit tests for scores.stats.tests.acovf
5Package: https://www.statsmodels.org/devel/
7## Source License
9Copyright (C) 2006, Jonathan E. Taylor
10All rights reserved.
12Copyright (c) 2006-2008 Scipy Developers.
13All rights reserved.
15Copyright (c) 2009-2018 statsmodels Developers.
16All rights reserved.
19Redistribution and use in source and binary forms, with or without
20modification, are permitted provided that the following conditions are met:
22 a. Redistributions of source code must retain the above copyright notice,
23 this list of conditions and the following disclaimer.
24 b. Redistributions in binary form must reproduce the above copyright
25 notice, this list of conditions and the following disclaimer in the
26 documentation and/or other materials provided with the distribution.
27 c. Neither the name of statsmodels nor the names of its contributors
28 may be used to endorse or promote products derived from this software
29 without specific prior written permission.
32THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35ARE DISCLAIMED. IN NO EVENT SHALL STATSMODELS OR CONTRIBUTORS BE LIABLE FOR
36ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
38SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
39CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
42DAMAGE.
43"""
45import pytest
46from numpy.testing import assert_equal
48from scores.stats.statistical_tests.acovf import _next_regular
51@pytest.mark.parametrize(
52 ("x", "y"),
53 [
54 (1, 1),
55 (2, 2),
56 (3, 3),
57 (4, 4),
58 (5, 5),
59 (6, 6),
60 (7, 8),
61 (8, 8),
62 (14, 15),
63 (15, 15),
64 (16, 16),
65 (17, 18),
66 (1021, 1024),
67 (1536, 1536),
68 (51200000, 51200000),
69 (510183360, 510183360),
70 (510183360 + 1, 512000000),
71 (511000000, 512000000),
72 (854296875, 854296875),
73 (854296875 + 1, 859963392),
74 (196608000000, 196608000000),
75 (196608000000 + 1, 196830000000),
76 (8789062500000, 8789062500000),
77 (8789062500000 + 1, 8796093022208),
78 (206391214080000, 206391214080000),
79 (206391214080000 + 1, 206624260800000),
80 (470184984576000, 470184984576000),
81 (470184984576000 + 1, 470715894135000),
82 (7222041363087360, 7222041363087360),
83 (7222041363087360 + 1, 7230196133913600),
84 # power of 5 5**23
85 (11920928955078125, 11920928955078125),
86 (11920928955078125 - 1, 11920928955078125),
87 # power of 3 3**34
88 (16677181699666569, 16677181699666569),
89 (16677181699666569 - 1, 16677181699666569),
90 # power of 2 2**54
91 (18014398509481984, 18014398509481984),
92 (18014398509481984 - 1, 18014398509481984),
93 # above this), int(ceil(n)) == int(ceil(n+1))
94 (19200000000000000, 19200000000000000),
95 (19200000000000000 + 1, 19221679687500000),
96 (288230376151711744, 288230376151711744),
97 (288230376151711744 + 1, 288325195312500000),
98 (288325195312500000 - 1, 288325195312500000),
99 (288325195312500000, 288325195312500000),
100 (288325195312500000 + 1, 288555831593533440),
101 # power of 3 3**83
102 (3**83 - 1, 3**83),
103 (3**83, 3**83),
104 # power of 2 2**135
105 (2**135 - 1, 2**135),
106 (2**135, 2**135),
107 # power of 5 5**57
108 (5**57 - 1, 5**57),
109 (5**57, 5**57),
110 # http,//www.drdobbs.com/228700538
111 # 2**96 * 3**1 * 5**13
112 (2**96 * 3**1 * 5**13 - 1, 2**96 * 3**1 * 5**13),
113 (2**96 * 3**1 * 5**13, 2**96 * 3**1 * 5**13),
114 (2**96 * 3**1 * 5**13 + 1, 2**43 * 3**11 * 5**29),
115 # 2**36 * 3**69 * 5**7
116 (2**36 * 3**69 * 5**7 - 1, 2**36 * 3**69 * 5**7),
117 (2**36 * 3**69 * 5**7, 2**36 * 3**69 * 5**7),
118 (2**36 * 3**69 * 5**7 + 1, 2**90 * 3**32 * 5**9),
119 # 2**37 * 3**44 * 5**42
120 (2**37 * 3**44 * 5**42 - 1, 2**37 * 3**44 * 5**42),
121 (2**37 * 3**44 * 5**42, 2**37 * 3**44 * 5**42),
122 (2**37 * 3**44 * 5**42 + 1, 2**20 * 3**106 * 5**7),
123 ],
124)
125def test_next_regular(x, y):
126 assert_equal(_next_regular(x), y)