Skip to content

Commit d8f56d1

Browse files
committed
Remove some usages of uninitialized memory in constraint tests
1 parent 160bc06 commit d8f56d1

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

test/unit/math/prim/constraint/lb_transform_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ TEST(prob_transform, lb_constrain_matrix) {
3737
double lbd = 2.0;
3838

3939
Eigen::VectorXd lb_bad(3);
40+
lb_bad << 1.0, 2.0, 3.0;
4041

4142
// matrix, real
4243
{
@@ -93,6 +94,7 @@ TEST(prob_transform, lb_constrain_std_vector) {
9394
double lbd = 2.0;
9495

9596
Eigen::VectorXd lb_bad(3);
97+
lb_bad << 1.0, 2.0, 3.0;
9698

9799
std::vector<Eigen::VectorXd> x_vec = {x, x};
98100
std::vector<Eigen::VectorXd> lb_vec = {lb, lb2};

test/unit/math/prim/constraint/lub_transform_test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ TEST(prob_transform, lub_constrain_matrix) {
134134
double lbd = -2.0;
135135

136136
Eigen::VectorXd ub_bad(3);
137+
ub_bad << 1.0, 2.0, 3.0;
138+
137139
Eigen::VectorXd lb_bad(3);
140+
lb_bad << -1.0, -2.0, -3.0;
138141

139142
// matrix, real, real
140143
{
@@ -330,7 +333,9 @@ TEST(prob_transform, lub_constrain_stdvec_matrix) {
330333
double lbd = -2.0;
331334

332335
Eigen::VectorXd ub_bad(3);
336+
ub_bad << 1.0, 2.0, 3.0;
333337
Eigen::VectorXd lb_bad(3);
338+
lb_bad << -1.0, -2.0, -3.0;
334339

335340
std::vector<Eigen::VectorXd> x_vec{x, x};
336341
std::vector<Eigen::VectorXd> ub_vec{ub, ub};

test/unit/math/prim/constraint/ub_transform_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ TEST(prob_transform, ub_constrain_matrix) {
3737
double ubd = 2.0;
3838

3939
Eigen::VectorXd ub_bad(3);
40+
ub_bad << 1.0, 2.0, 3.0;
4041

4142
// matrix, real
4243
{
@@ -94,6 +95,7 @@ TEST(prob_transform, ub_constrain_std_vector) {
9495
double ubd = 2.0;
9596

9697
Eigen::VectorXd ub_bad(3);
98+
ub_bad << 1.0, 2.0, 3.0;
9799

98100
std::vector<Eigen::VectorXd> x_vec = {x, 2 * x};
99101
std::vector<Eigen::VectorXd> ub_vec = {ub, ub2};

0 commit comments

Comments
 (0)