@@ -657,6 +657,31 @@ function test_modify_vectorsets()
657657 return
658658end
659659
660+ function test_modify_constants_bounds_error ()
661+ model = _new_VectorSets ()
662+ src = MOI. Utilities. Model {Int} ()
663+ x = MOI. add_variables (src, 2 )
664+ c = MOI. add_constraint (
665+ src,
666+ MOI. VectorAffineFunction {Int} (
667+ MOI. VectorAffineTerm .(1 , MOI. ScalarAffineTerm .(1 , x)),
668+ [1 , 3 ],
669+ ),
670+ MOI. SecondOrderCone (2 ),
671+ )
672+ index_map = MOI. copy_to (model, src)
673+ resize! (model. constraints. constants, 0 )
674+ @test_throws (
675+ BoundsError,
676+ MOI. modify (
677+ model. constraints,
678+ index_map[c],
679+ MOI. VectorConstantChange ([4 , 5 ]),
680+ ),
681+ )
682+ return
683+ end
684+
660685function test_modify_set_constants ()
661686 model = MOI. Utilities. Model {Float64} ()
662687 x = MOI. add_variables (model, 3 )
@@ -683,8 +708,13 @@ function test_modify_set_constants()
683708 index_map = MOI. copy_to (cache, model)
684709 ci = index_map[p_ref]
685710 change = MOI. VectorConstantChange ([4.0 , 5.0 , 6.0 ])
711+ constants_type = typeof (cache. constraints. constants)
686712 @test_throws (
687- MOI. ModifyConstraintNotAllowed (ci, change),
713+ MOI. ModifyConstraintNotAllowed (
714+ ci,
715+ change,
716+ " `modify_constants` is not implemented for `$constants_type `" ,
717+ ),
688718 MOI. modify (cache, ci, change),
689719 )
690720 return
0 commit comments