Skip to content

Commit 7a800b6

Browse files
authored
Merge pull request #1947 from stan-dev/cleanup/1886-test-util-cleanup-part2
Cleanup/1886 cleanup global space in prim tests, replace pull_msg with expect_throw_msg
2 parents 844c61f + 63b873e commit 7a800b6

96 files changed

Lines changed: 1462 additions & 1601 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

runTests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def generateTests(j):
9797
else:
9898
doCommand('make -j%d generate-tests -s' % (j or 1))
9999

100-
101100
def makeTest(name, j):
102101
"""Run the make command for a given single test."""
103102
if isWin():

test/unit/math/prim/err/check_2F1_converges_test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
#include <gtest/gtest.h>
33
#include <limits>
44

5-
using stan::math::check_2F1_converges;
6-
75
TEST(passesOnConvergentArgs, Check2F1Converges) {
6+
using stan::math::check_2F1_converges;
87
const char* function = "check_2F1_converges";
98
double a1 = 1.0;
109
double a2 = 1.0;

test/unit/math/prim/err/check_3F2_converges_test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
#include <gtest/gtest.h>
33
#include <limits>
44

5-
using stan::math::check_3F2_converges;
6-
75
TEST(passesOnConvergentArgs, Check3F2Converges) {
6+
using stan::math::check_3F2_converges;
87
const char* function = "check_3F2_converges";
98
double a1 = 1.0;
109
double a2 = 1.0;

test/unit/math/prim/err/check_bounded_test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
#include <gtest/gtest.h>
33
#include <limits>
44

5-
using stan::math::check_bounded;
6-
75
TEST(ErrorHandlingScalar, CheckBounded_x) {
6+
using stan::math::check_bounded;
87
const char* function = "check_bounded";
98
const char* name = "x";
109
double x = 0;
@@ -51,6 +50,7 @@ TEST(ErrorHandlingScalar, CheckBounded_x) {
5150
<< ", " << low;
5251
}
5352
TEST(ErrorHandlingScalar, CheckBounded_Low) {
53+
using stan::math::check_bounded;
5454
const char* function = "check_bounded";
5555
const char* name = "x";
5656
double x = 0;
@@ -77,6 +77,7 @@ TEST(ErrorHandlingScalar, CheckBounded_Low) {
7777
<< ", " << high;
7878
}
7979
TEST(ErrorHandlingScalar, CheckBounded_High) {
80+
using stan::math::check_bounded;
8081
const char* function = "check_bounded";
8182
const char* name = "x";
8283
double x = 0;
@@ -103,6 +104,7 @@ TEST(ErrorHandlingScalar, CheckBounded_High) {
103104
<< ", " << high;
104105
}
105106
TEST(ErrorHandlingScalar, CheckBounded_nan) {
107+
using stan::math::check_bounded;
106108
double nan = std::numeric_limits<double>::quiet_NaN();
107109

108110
const char* function = "check_bounded";
@@ -123,6 +125,7 @@ TEST(ErrorHandlingScalar, CheckBounded_nan) {
123125
}
124126

125127
TEST(ErrorHandlingScalar, CheckBounded_size_zero_vector) {
128+
using stan::math::check_bounded;
126129
const char* function = "check_bounded";
127130
const char* name = "x";
128131
double x = 0;

test/unit/math/prim/err/check_corr_matrix_test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
#include <limits>
44
#include <string>
55

6-
using stan::math::check_corr_matrix;
7-
86
TEST(ErrorHandlingMatrix, CheckCorrMatrix) {
7+
using stan::math::check_corr_matrix;
98
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> y;
109
y.resize(2, 2);
1110

@@ -17,6 +16,7 @@ TEST(ErrorHandlingMatrix, CheckCorrMatrix) {
1716
}
1817

1918
TEST(ErrorHandlingMatrix, CheckCorrMatrix_one_indexed_message) {
19+
using stan::math::check_corr_matrix;
2020
std::string message;
2121
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> y;
2222
y.resize(2, 2);
@@ -37,6 +37,7 @@ TEST(ErrorHandlingMatrix, CheckCorrMatrix_one_indexed_message) {
3737
}
3838

3939
TEST(ErrorHandlingMatrix, CheckCorrMatrix_nan) {
40+
using stan::math::check_corr_matrix;
4041
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> y;
4142
y.resize(2, 2);
4243
double nan = std::numeric_limits<double>::quiet_NaN();

test/unit/math/prim/err/check_finite_test.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
#include <string>
55
#include <vector>
66

7-
using stan::math::check_finite;
8-
9-
// ---------- check_finite: vector tests ----------
107
TEST(ErrorHandlingArr, CheckFinite_Vector) {
8+
using stan::math::check_finite;
119
const char* function = "check_finite";
1210
std::vector<double> x = {-1, 0, 1};
1311
ASSERT_NO_THROW(check_finite(function, "x", x))
@@ -27,6 +25,7 @@ TEST(ErrorHandlingArr, CheckFinite_Vector) {
2725
}
2826

2927
TEST(ErrorHandlingArr, CheckFinite_nan) {
28+
using stan::math::check_finite;
3029
const char* function = "check_finite";
3130
double nan = std::numeric_limits<double>::quiet_NaN();
3231

@@ -40,8 +39,8 @@ TEST(ErrorHandlingArr, CheckFinite_nan) {
4039
EXPECT_THROW(check_finite(function, "x", x), std::domain_error);
4140
}
4241

43-
// ---------- check_finite: matrix tests ----------
4442
TEST(ErrorHandlingMat, CheckFinite_Matrix) {
43+
using stan::math::check_finite;
4544
const char* function = "check_finite";
4645
Eigen::Matrix<double, Eigen::Dynamic, 1> x;
4746

@@ -67,6 +66,7 @@ TEST(ErrorHandlingMat, CheckFinite_Matrix) {
6766
}
6867

6968
TEST(ErrorHandlingMat, CheckFinite_Matrix_one_indexed_message) {
69+
using stan::math::check_finite;
7070
const char* function = "check_finite";
7171
Eigen::Matrix<double, Eigen::Dynamic, 1> x;
7272
std::string message;
@@ -86,6 +86,7 @@ TEST(ErrorHandlingMat, CheckFinite_Matrix_one_indexed_message) {
8686
}
8787

8888
TEST(ErrorHandlingMat, CheckFinite_nan) {
89+
using stan::math::check_finite;
8990
const char* function = "check_finite";
9091
double nan = std::numeric_limits<double>::quiet_NaN();
9192

@@ -101,6 +102,7 @@ TEST(ErrorHandlingMat, CheckFinite_nan) {
101102
}
102103

103104
TEST(ErrorHandlingScalar, CheckFinite) {
105+
using stan::math::check_finite;
104106
const char* function = "check_finite";
105107
double x = 0;
106108

@@ -119,6 +121,7 @@ TEST(ErrorHandlingScalar, CheckFinite) {
119121
}
120122

121123
TEST(ErrorHandlingScalar, CheckFinite_nan) {
124+
using stan::math::check_finite;
122125
const char* function = "check_finite";
123126
double nan = std::numeric_limits<double>::quiet_NaN();
124127

test/unit/math/prim/err/check_greater_or_equal_test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
#include <limits>
44
#include <string>
55

6-
using stan::math::check_greater_or_equal;
7-
86
TEST(ErrorHandlingMat, CheckGreaterOrEqualMatrix) {
7+
using stan::math::check_greater_or_equal;
98
const char* function = "check_greater_or_equal";
109
double x;
1110
double low;
@@ -120,6 +119,7 @@ TEST(ErrorHandlingMat, CheckGreaterOrEqualMatrix) {
120119
}
121120

122121
TEST(ErrorHandlingMat, CheckGreaterOrEqual_Matrix_one_indexed_message) {
122+
using stan::math::check_greater_or_equal;
123123
const char* function = "check_greater_or_equal";
124124
double x;
125125
double low;
@@ -178,6 +178,7 @@ TEST(ErrorHandlingMat, CheckGreaterOrEqual_Matrix_one_indexed_message) {
178178
}
179179

180180
TEST(ErrorHandlingMat, CheckGreaterOrEqual_nan) {
181+
using stan::math::check_greater_or_equal;
181182
const char* function = "check_greater_or_equal";
182183
double nan = std::numeric_limits<double>::quiet_NaN();
183184

@@ -218,6 +219,7 @@ TEST(ErrorHandlingMat, CheckGreaterOrEqual_nan) {
218219
}
219220

220221
TEST(ErrorHandlingScalar, CheckGreaterOrEqual) {
222+
using stan::math::check_greater_or_equal;
221223
const char* function = "check_greater_or_equal";
222224
double x = 10.0;
223225
double lb = 0.0;
@@ -250,6 +252,7 @@ TEST(ErrorHandlingScalar, CheckGreaterOrEqual) {
250252
}
251253

252254
TEST(ErrorHandlingScalar, CheckGreaterOrEqual_nan) {
255+
using stan::math::check_greater_or_equal;
253256
const char* function = "check_greater_or_equal";
254257
double x = 10.0;
255258
double lb = 0.0;

test/unit/math/prim/err/check_greater_test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
#include <limits>
44
#include <string>
55

6-
using stan::math::check_greater;
7-
86
TEST(ErrorHandlingMat, CheckGreater_Matrix) {
7+
using stan::math::check_greater;
98
const char* function = "check_greater";
109
double x;
1110
double low;
@@ -110,6 +109,7 @@ TEST(ErrorHandlingMat, CheckGreater_Matrix) {
110109
}
111110

112111
TEST(ErrorHandlingMat, CheckGreater_Matrix_one_indexed_message) {
112+
using stan::math::check_greater;
113113
const char* function = "check_greater";
114114
double x;
115115
double low;
@@ -168,6 +168,7 @@ TEST(ErrorHandlingMat, CheckGreater_Matrix_one_indexed_message) {
168168
}
169169

170170
TEST(ErrorHandlingMat, CheckGreater_nan) {
171+
using stan::math::check_greater;
171172
const char* function = "check_greater";
172173
double x = 10.0;
173174
double lb = 0.0;
@@ -179,6 +180,7 @@ TEST(ErrorHandlingMat, CheckGreater_nan) {
179180
}
180181

181182
TEST(ErrorHandlingScalar, CheckGreater) {
183+
using stan::math::check_greater;
182184
const char* function = "check_greater";
183185
double x = 10.0;
184186
double lb = 0.0;
@@ -210,6 +212,7 @@ TEST(ErrorHandlingScalar, CheckGreater) {
210212
}
211213

212214
TEST(ErrorHandlingScalar, CheckGreater_nan) {
215+
using stan::math::check_greater;
213216
const char* function = "check_greater";
214217
double x = 10.0;
215218
double lb = 0.0;

test/unit/math/prim/err/check_less_or_equal_test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
#include <limits>
44
#include <string>
55

6-
using stan::math::check_less_or_equal;
7-
86
TEST(ErrorHandlingMat, CheckLessOrEqual_Matrix) {
7+
using stan::math::check_less_or_equal;
98
const char* function = "check_less_or_equal";
109
double x;
1110
double high;
@@ -84,6 +83,7 @@ TEST(ErrorHandlingMat, CheckLessOrEqual_Matrix) {
8483
}
8584

8685
TEST(ErrorHandlingMat, CheckLessOrEqual_Matrix_one_indexed_message) {
86+
using stan::math::check_less_or_equal;
8787
const char* function = "check_less";
8888
double x;
8989
double high;
@@ -142,6 +142,7 @@ TEST(ErrorHandlingMat, CheckLessOrEqual_Matrix_one_indexed_message) {
142142
}
143143

144144
TEST(ErrorHandlingMat, CheckLessOrEqual_nan) {
145+
using stan::math::check_less_or_equal;
145146
const char* function = "check_less_or_equal";
146147
double nan = std::numeric_limits<double>::quiet_NaN();
147148
Eigen::Matrix<double, Eigen::Dynamic, 1> x_vec(3);
@@ -181,6 +182,7 @@ TEST(ErrorHandlingMat, CheckLessOrEqual_nan) {
181182
}
182183

183184
TEST(ErrorHandlingScalar, CheckLessOrEqual) {
185+
using stan::math::check_less_or_equal;
184186
const char* function = "check_less_or_equal";
185187
double x = -10.0;
186188
double lb = 0.0;
@@ -213,6 +215,7 @@ TEST(ErrorHandlingScalar, CheckLessOrEqual) {
213215
}
214216

215217
TEST(ErrorHandlingScalar, CheckLessOrEqual_nan) {
218+
using stan::math::check_less_or_equal;
216219
const char* function = "check_less_or_equal";
217220
double x = 10.0;
218221
double lb = 0.0;

test/unit/math/prim/err/check_less_test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
#include <limits>
44
#include <string>
55

6-
using stan::math::check_less;
7-
86
TEST(ErrorHandlingMat, CheckLess_Matrix) {
7+
using stan::math::check_less;
98
const char* function = "check_less";
109
double x;
1110
double high;
@@ -81,6 +80,7 @@ TEST(ErrorHandlingMat, CheckLess_Matrix) {
8180
}
8281

8382
TEST(ErrorHandlingMat, CheckLess_Matrix_one_indexed_message) {
83+
using stan::math::check_less;
8484
const char* function = "check_less";
8585
double x;
8686
double high;
@@ -139,6 +139,7 @@ TEST(ErrorHandlingMat, CheckLess_Matrix_one_indexed_message) {
139139
}
140140

141141
TEST(ErrorHandlingMat, CheckLess_nan) {
142+
using stan::math::check_less;
142143
const char* function = "check_less";
143144
double nan = std::numeric_limits<double>::quiet_NaN();
144145

@@ -176,6 +177,7 @@ TEST(ErrorHandlingMat, CheckLess_nan) {
176177
}
177178

178179
TEST(ErrorHandlingScalar, CheckLess) {
180+
using stan::math::check_less;
179181
const char* function = "check_less";
180182
double x = -10.0;
181183
double lb = 0.0;
@@ -207,6 +209,7 @@ TEST(ErrorHandlingScalar, CheckLess) {
207209
}
208210

209211
TEST(ErrorHandlingScalar, CheckLess_nan) {
212+
using stan::math::check_less;
210213
const char* function = "check_less";
211214
double x = 10.0;
212215
double lb = 0.0;

0 commit comments

Comments
 (0)