From 5b7cc3adac86f713ddd18d47f7d5ea0fee7c832b Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Tue, 12 Nov 2024 20:41:28 +1300 Subject: [PATCH] Update test_macros.jl --- test/test_macros.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/test_macros.jl b/test/test_macros.jl index 91315d52399..ec39bc9edb9 100644 --- a/test/test_macros.jl +++ b/test/test_macros.jl @@ -2494,7 +2494,7 @@ function test_subexpression_kwarg() @test ex isa VariableRef @test model[:ex] isa VariableRef @test model[:ex] === ex - @test occursin("ex - sin(x) = 0", sprint(print, model)) + @test occursin(r"ex - sin\(x\) ==? 0", sprint(print, model)) @test num_variables(model) == 2 return end @@ -2505,8 +2505,8 @@ function test_subexpression_kwarg_array() @expression(model, ex[i in 1:2], sin(x[i]), subexpression = true) @test ex isa Vector{VariableRef} @test model[:ex] === ex - @test occursin("ex[1] - sin(x[1]) = 0", sprint(print, model)) - @test occursin("ex[2] - sin(x[2]) = 0", sprint(print, model)) + @test occursin(r"ex\[1\] - sin\(x\[1\]\) ==? 0", sprint(print, model)) + @test occursin(r"ex\[2\] - sin\(x\[2\]\) ==? 0", sprint(print, model)) @test num_variables(model) == 4 return end @@ -2517,8 +2517,8 @@ function test_subexpression_kwarg_dense_axis_array() @expression(model, ex[i in 2:3], sin(x[i]), subexpression = true) @test ex isa Containers.DenseAxisArray{VariableRef} @test model[:ex] === ex - @test occursin("ex[2] - sin(x[2]) = 0", sprint(print, model)) - @test occursin("ex[3] - sin(x[3]) = 0", sprint(print, model)) + @test occursin(r"ex\[2\] - sin\(x\[2\]\) ==? 0", sprint(print, model)) + @test occursin(r"ex\[3\] - sin\(x\[3\]\) ==? 0", sprint(print, model)) @test num_variables(model) == 4 return end @@ -2529,8 +2529,8 @@ function test_subexpression_kwarg_dense_axis_array() @expression(model, ex[i in 1:3; isodd(i)], sin(x[i]), subexpression = true) @test ex isa Containers.SparseAxisArray{VariableRef} @test model[:ex] === ex - @test occursin("ex[1] - sin(x[1]) = 0", sprint(print, model)) - @test occursin("ex[3] - sin(x[3]) = 0", sprint(print, model)) + @test occursin(r"ex\[1\] - sin\(x\[1\]\) ==? 0", sprint(print, model)) + @test occursin(r"ex\[3\] - sin\(x\[3\]\) ==? 0", sprint(print, model)) @test num_variables(model) == 4 return end @@ -2541,8 +2541,8 @@ function test_subexpression_kwarg_vector_element() @expression(model, ex, sin.(x), subexpression = true) @test ex isa Vector{VariableRef} @test model[:ex] === ex - @test occursin("ex - sin(x[1]) = 0", sprint(print, model)) - @test occursin("ex - sin(x[2]) = 0", sprint(print, model)) + @test occursin(r"ex - sin\(x\[1\]\) ==? 0", sprint(print, model)) + @test occursin(r"ex - sin\(x\[2\]\) ==? 0", sprint(print, model)) @test num_variables(model) == 4 return end @@ -2553,7 +2553,7 @@ function test_subexpression_kwarg_no_name() ex = @expression(model, sin(x), subexpression = true) @test ex isa VariableRef @test !haskey(model, :ex) - @test occursin("_[2] - sin(x) = 0", sprint(print, model)) + @test occursin(r"\_\[2\] - sin\(x\) ==? 0", sprint(print, model)) @test num_variables(model) == 2 return end