88
99const bool dev_run = false ;
1010
11- void runWriteReadCheckSolution (Highs& highs, const std::string model,
11+ void runWriteReadCheckSolution (Highs& highs, const std::string& test_name, const std::string& model,
1212 const HighsModelStatus require_model_status,
1313 const HighsInt write_solution_style);
1414
1515void runSetLpSolution (const std::string model);
1616
1717TEST_CASE (" check-solution" , " [highs_check_solution]" ) {
18+ std::string test_name = Catch::getResultCapture ().getCurrentTestName ();
1819 std::string model = " " ;
1920 std::string model_file;
2021 HighsStatus read_status;
@@ -42,7 +43,8 @@ TEST_CASE("check-solution", "[highs_check_solution]") {
4243 REQUIRE (read_status == require_read_status);
4344
4445 require_model_status = HighsModelStatus::kOptimal ;
45- runWriteReadCheckSolution (highs, model, require_model_status,
46+ test_name += " -" ;
47+ runWriteReadCheckSolution (highs, test_name, model, require_model_status,
4648 write_solution_style);
4749 SpecialLps special_lps;
4850 HighsLp lp;
@@ -51,21 +53,24 @@ TEST_CASE("check-solution", "[highs_check_solution]") {
5153 model = " distillation" ;
5254 special_lps.distillationMip (lp, require_model_status, optimal_objective);
5355 highs.passModel (lp);
54- runWriteReadCheckSolution (highs, model, require_model_status,
56+ test_name += " -" ;
57+ runWriteReadCheckSolution (highs, test_name, model, require_model_status,
5558 write_solution_style);
5659
5760 lp.clear ();
5861 model = " primalDualInfeasible1Lp" ;
5962 special_lps.primalDualInfeasible1Lp (lp, require_model_status);
6063 highs.passModel (lp);
61- runWriteReadCheckSolution (highs, model, require_model_status,
64+ test_name += " -" ;
65+ runWriteReadCheckSolution (highs, test_name, model, require_model_status,
6266 write_solution_style);
6367 // Second pass uses sparse format
6468 write_solution_style = kSolutionStyleSparse ;
6569 }
6670}
6771
6872TEST_CASE (" check-set-mip-solution" , " [highs_check_solution]" ) {
73+ const std::string test_name = Catch::getResultCapture ().getCurrentTestName ();
6974 HighsStatus return_status;
7075 const std::string model = " flugpl" ;
7176 std::string model_file =
@@ -83,7 +88,7 @@ TEST_CASE("check-set-mip-solution", "[highs_check_solution]") {
8388 HighsInt scratch_num_nodes = info.mip_node_count ;
8489 if (dev_run) printf (" Num nodes = %d\n " , int (scratch_num_nodes));
8590
86- std::string solution_file = model + " .sol" ;
91+ std::string solution_file = test_name + model + " .sol" ;
8792 if (dev_run) return_status = highs.writeSolution (" " );
8893 return_status = highs.writeSolution (solution_file);
8994 REQUIRE (return_status == HighsStatus::kOk );
@@ -354,8 +359,9 @@ TEST_CASE("check-set-rowwise-lp-solution", "[highs_check_solution]") {
354359}
355360
356361TEST_CASE (" check-set-mip-solution-extra-row" , " [highs_check_solution]" ) {
362+ const std::string test_name = Catch::getResultCapture ().getCurrentTestName ();
363+ const std::string solution_file_name = test_name + " .sol" ;
357364 Highs highs;
358- const std::string solution_file_name = " temp.sol" ;
359365 highs.setOptionValue (" output_flag" , dev_run);
360366 highs.addVar (0 , 2 );
361367 highs.addVar (0 , 2 );
@@ -396,6 +402,7 @@ TEST_CASE("check-set-illegal-solution", "[highs_check_solution]") {
396402}
397403
398404TEST_CASE (" read-miplib-solution" , " [highs_check_solution]" ) {
405+ const std::string test_name = Catch::getResultCapture ().getCurrentTestName ();
399406 HighsLp lp;
400407 lp.num_col_ = 5 ;
401408 lp.num_row_ = 1 ;
@@ -417,7 +424,7 @@ TEST_CASE("read-miplib-solution", "[highs_check_solution]") {
417424 REQUIRE (h.run () == HighsStatus::kOk );
418425 // REQUIRE(h.writeSolution("", kSolutionStylePretty) == HighsStatus::kOk);
419426 const std::vector<double >& col_value = h.getSolution ().col_value ;
420- std::string miplib_sol_file = " miplib .sol" ;
427+ std::string miplib_sol_file = test_name + " .sol" ;
421428 FILE* file = fopen (miplib_sol_file.c_str (), " w" );
422429 REQUIRE (file != 0 );
423430 fprintf (file, " =obj= 22\n " );
@@ -441,7 +448,8 @@ TEST_CASE("read-miplib-solution", "[highs_check_solution]") {
441448 std::remove (miplib_sol_file.c_str ());
442449}
443450
444- void runWriteReadCheckSolution (Highs& highs, const std::string model,
451+ void runWriteReadCheckSolution (Highs& highs, const std::string& test_name,
452+ const std::string& model,
445453 const HighsModelStatus require_model_status,
446454 const HighsInt write_solution_style) {
447455 HighsStatus run_status;
@@ -455,7 +463,7 @@ void runWriteReadCheckSolution(Highs& highs, const std::string model,
455463 status = highs.getModelStatus ();
456464 REQUIRE (status == require_model_status);
457465
458- solution_file = model + " .sol" ;
466+ solution_file = test_name + model + " .sol" ;
459467 if (dev_run)
460468 printf (" Writing solution in style %d to %s\n " , int (write_solution_style),
461469 solution_file.c_str ());
0 commit comments