@@ -11,35 +11,4 @@ using InteractiveUtils, Test
1111 Aqua. test_piracies (BoundaryValueDiffEqCore)
1212 Aqua. test_ambiguities (BoundaryValueDiffEqCore; recursive = false )
1313 end
14-
15- @testset " __extract_lcons_ucons length" begin
16- # Regression test: the function must return vectors matching the actual
17- # constraint vector length (= length(resid_prototype)), not a reconstruction
18- # from (M, N, ...) which was wrong for several solvers.
19- using BoundaryValueDiffEqCore: __extract_lcons_ucons
20- using SciMLBase: BVProblem
21-
22- f! (du, u, p, t) = (du[1 ] = u[2 ]; du[2 ] = - u[1 ])
23- bc! (res, u, p, t) = (res[1 ] = u (0.0 )[1 ]; res[2 ] = u (1.0 )[1 ])
24-
25- # Fallback path (isnothing(prob.lcons)): both vectors have length == constraint_length
26- prob = BVProblem (f!, bc!, [0.0 , 0.0 ], (0.0 , 1.0 ); bcresid_prototype = zeros (2 ))
27- lc, uc = __extract_lcons_ucons (prob, Float64, 42 )
28- @test length (lc) == 42
29- @test length (uc) == 42
30- @test all (iszero, lc)
31- @test all (iszero, uc)
32-
33- # User-provided lcons/ucons: values preserved, padded with zeros to constraint_length
34- prob2 = BVProblem (f!, bc!, [0.0 , 0.0 ], (0.0 , 1.0 );
35- bcresid_prototype = zeros (2 ),
36- lcons = [- 1.0 , - 2.0 ], ucons = [1.0 , 2.0 ])
37- lc2, uc2 = __extract_lcons_ucons (prob2, Float64, 10 )
38- @test length (lc2) == 10
39- @test length (uc2) == 10
40- @test lc2[1 : 2 ] == [- 1.0 , - 2.0 ]
41- @test uc2[1 : 2 ] == [1.0 , 2.0 ]
42- @test all (iszero, lc2[3 : end ])
43- @test all (iszero, uc2[3 : end ])
44- end
4514end
0 commit comments