Skip to content

Commit eb2b422

Browse files
style(pre-commit): autofix
1 parent 1edbd0c commit eb2b422

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

localization/autoware_localization_util/test/test_tpe.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ TEST(TreeStructuredParzenEstimatorTest, MinimizationTest)
8989
TreeStructuredParzenEstimator estimator(
9090
TreeStructuredParzenEstimator::Direction::MINIMIZE, k_trials_num / 2, sample_mean,
9191
sample_stddev);
92-
92+
9393
for (int64_t trial = 0; trial < k_trials_num; trial++) {
9494
const TreeStructuredParzenEstimator::Input input = estimator.get_next_input();
9595
const double score = quadratic_function(input);
@@ -114,7 +114,7 @@ TEST(TreeStructuredParzenEstimatorTest, SingleDimensionTest)
114114
TreeStructuredParzenEstimator estimator(
115115
TreeStructuredParzenEstimator::Direction::MAXIMIZE, k_trials_num / 2, sample_mean,
116116
sample_stddev);
117-
117+
118118
for (int64_t trial = 0; trial < k_trials_num; trial++) {
119119
const TreeStructuredParzenEstimator::Input input = estimator.get_next_input();
120120
const double score = linear_function(input);
@@ -132,7 +132,7 @@ TEST(TreeStructuredParzenEstimatorTest, EmptyTrials)
132132

133133
TreeStructuredParzenEstimator estimator(
134134
TreeStructuredParzenEstimator::Direction::MAXIMIZE, 10, sample_mean, sample_stddev);
135-
135+
136136
// Should not crash when getting input without any trials
137137
const TreeStructuredParzenEstimator::Input input = estimator.get_next_input();
138138
EXPECT_EQ(input.size(), 2u);
@@ -145,11 +145,11 @@ TEST(TreeStructuredParzenEstimatorTest, SingleTrial)
145145

146146
TreeStructuredParzenEstimator estimator(
147147
TreeStructuredParzenEstimator::Direction::MAXIMIZE, 0, sample_mean, sample_stddev);
148-
148+
149149
// Add one trial
150150
const TreeStructuredParzenEstimator::Input first_input{1.0, 1.0};
151151
estimator.add_trial({first_input, 1.0});
152-
152+
153153
// Should be able to get next input
154154
const TreeStructuredParzenEstimator::Input next_input = estimator.get_next_input();
155155
EXPECT_EQ(next_input.size(), 2u);
@@ -160,10 +160,10 @@ TEST(TreeStructuredParzenEstimatorTest, LogGaussianPdf)
160160
TreeStructuredParzenEstimator::Input input{1.0, 2.0};
161161
TreeStructuredParzenEstimator::Input mu{1.0, 2.0};
162162
TreeStructuredParzenEstimator::Input sigma{1.0, 1.0};
163-
163+
164164
double log_pdf = TreeStructuredParzenEstimator::log_gaussian_pdf(input, mu, sigma);
165165
EXPECT_NEAR(log_pdf, -1.8378770664093453, 1e-6); // Expected value calculated manually
166-
166+
167167
// Test with different sigma
168168
TreeStructuredParzenEstimator::Input sigma2{0.5, 0.5};
169169
log_pdf = TreeStructuredParzenEstimator::log_gaussian_pdf(input, mu, sigma2);
@@ -177,18 +177,18 @@ TEST(TreeStructuredParzenEstimatorTest, DifferentSampleStddev)
177177

178178
TreeStructuredParzenEstimator estimator(
179179
TreeStructuredParzenEstimator::Direction::MAXIMIZE, 10, sample_mean, sample_stddev);
180-
180+
181181
// Add some trials
182182
for (int i = 0; i < 5; ++i) {
183183
TreeStructuredParzenEstimator::Input input{0.1 * i, 0.01 * i, 1.0 * i};
184184
estimator.add_trial({input, static_cast<double>(i)});
185185
}
186-
186+
187187
// Get next input and verify it's within reasonable bounds
188188
const TreeStructuredParzenEstimator::Input next_input = estimator.get_next_input();
189-
EXPECT_NEAR(next_input[0], 0.0, 2.0); // stddev = 1.0
190-
EXPECT_NEAR(next_input[1], 0.0, 0.2); // stddev = 0.1
191-
EXPECT_NEAR(next_input[2], 0.0, 20.0); // stddev = 10.0
189+
EXPECT_NEAR(next_input[0], 0.0, 2.0); // stddev = 1.0
190+
EXPECT_NEAR(next_input[1], 0.0, 0.2); // stddev = 0.1
191+
EXPECT_NEAR(next_input[2], 0.0, 20.0); // stddev = 10.0
192192
}
193193

194194
TEST(TreeStructuredParzenEstimatorTest, ComputeLogLikelihoodRatio)
@@ -198,17 +198,17 @@ TEST(TreeStructuredParzenEstimatorTest, ComputeLogLikelihoodRatio)
198198

199199
TreeStructuredParzenEstimator estimator(
200200
TreeStructuredParzenEstimator::Direction::MAXIMIZE, 0, sample_mean, sample_stddev);
201-
201+
202202
// Add some trials
203203
for (int i = 0; i < 10; ++i) {
204204
TreeStructuredParzenEstimator::Input input{0.1 * i, 0.1 * i};
205205
estimator.add_trial({input, static_cast<double>(i)});
206206
}
207-
207+
208208
// Test likelihood ratio for a point
209209
TreeStructuredParzenEstimator::Input test_point{0.5, 0.5};
210210
double ratio = estimator.compute_log_likelihood_ratio(test_point);
211-
211+
212212
// The exact value depends on the random sampling, but we can check it's finite
213213
EXPECT_TRUE(std::isfinite(ratio));
214214
}

0 commit comments

Comments
 (0)