@@ -763,6 +763,31 @@ function test_modify_vectorsets()
763763 return
764764end
765765
766+ function test_modify_constants_bounds_error ()
767+ model = _new_VectorSets ()
768+ src = MOI. Utilities. Model {Int} ()
769+ x = MOI. add_variables (src, 2 )
770+ c = MOI. add_constraint (
771+ src,
772+ MOI. VectorAffineFunction {Int} (
773+ MOI. VectorAffineTerm .(1 , MOI. ScalarAffineTerm .(1 , x)),
774+ [1 , 3 ],
775+ ),
776+ MOI. SecondOrderCone (2 ),
777+ )
778+ index_map = MOI. copy_to (model, src)
779+ resize! (model. constraints. constants, 0 )
780+ @test_throws (
781+ BoundsError,
782+ MOI. modify (
783+ model. constraints,
784+ index_map[c],
785+ MOI. VectorConstantChange ([4 , 5 ]),
786+ ),
787+ )
788+ return
789+ end
790+
766791function test_modify_set_constants ()
767792 model = MOI. Utilities. Model {Float64} ()
768793 x = MOI. add_variables (model, 3 )
@@ -789,8 +814,13 @@ function test_modify_set_constants()
789814 index_map = MOI. copy_to (cache, model)
790815 ci = index_map[p_ref]
791816 change = MOI. VectorConstantChange ([4.0 , 5.0 , 6.0 ])
817+ constants_type = typeof (cache. constraints. constants)
792818 @test_throws (
793- MOI. ModifyConstraintNotAllowed (ci, change),
819+ MOI. ModifyConstraintNotAllowed (
820+ ci,
821+ change,
822+ " `modify_constants` is not implemented for `$constants_type `" ,
823+ ),
794824 MOI. modify (cache, ci, change),
795825 )
796826 return
0 commit comments