Skip to content

Commit afad16b

Browse files
committed
Add tests
1 parent 0c37a26 commit afad16b

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

check/TestLpModification.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,10 @@ TEST_CASE("LP-modification", "[highs_data]") {
809809
col1357_upper[2] = 0;
810810
col1357_upper[3] = 0;
811811

812-
REQUIRE(highs.changeColsBounds(col1357_num_ix, col1357_col_set, col1357_lower,
812+
// Doing it with indices out of order is fine
813+
HighsInt col5713_col_set[] = {5, 7, 1, 3};
814+
815+
REQUIRE(highs.changeColsBounds(col1357_num_ix, col5713_col_set, col1357_lower,
813816
col1357_upper) == HighsStatus::kOk);
814817

815818
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
@@ -864,6 +867,29 @@ TEST_CASE("LP-modification", "[highs_data]") {
864867

865868
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
866869

870+
// Change row bounds again but with indices out of order
871+
HighsInt row7890135_row_set[] = {7, 8, 9, 0, 1, 3, 5};
872+
row0135789_lower[0] = local_lp.row_lower_[7];
873+
row0135789_lower[1] = local_lp.row_lower_[8];
874+
row0135789_lower[2] = local_lp.row_lower_[9];
875+
row0135789_lower[3] = local_lp.row_lower_[0];
876+
row0135789_lower[4] = local_lp.row_lower_[1];
877+
row0135789_lower[5] = local_lp.row_lower_[3];
878+
row0135789_lower[6] = local_lp.row_lower_[5];
879+
row0135789_upper[0] = local_lp.row_lower_[7];
880+
row0135789_upper[1] = local_lp.row_lower_[8];
881+
row0135789_upper[2] = local_lp.row_lower_[9];
882+
row0135789_upper[3] = local_lp.row_lower_[0];
883+
row0135789_upper[4] = local_lp.row_lower_[1];
884+
row0135789_upper[5] = local_lp.row_lower_[3];
885+
row0135789_upper[6] = local_lp.row_lower_[5];
886+
887+
REQUIRE(highs.changeRowsBounds(row0135789_num_ix, row7890135_row_set,
888+
row0135789_lower,
889+
row0135789_upper) == HighsStatus::kOk);
890+
891+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
892+
867893
REQUIRE(highs.deleteRows(0, num_row - 1) == HighsStatus::kOk);
868894

869895
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
@@ -926,6 +952,12 @@ TEST_CASE("LP-modification", "[highs_data]") {
926952
REQUIRE(highs.changeColsCost(col1357_num_ix, col1357_col_set, col1357_cost) ==
927953
HighsStatus::kOk);
928954

955+
// Do it again but with indices out of order
956+
double col5713_cost[] = {2.51, 2.71, 2.01, 2.31};
957+
958+
REQUIRE(highs.changeColsCost(col1357_num_ix, col5713_col_set, col5713_cost) ==
959+
HighsStatus::kOk);
960+
929961
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
930962

931963
// Attempting to set row bounds with infinite lower bound returns error

0 commit comments

Comments
 (0)