Skip to content

Commit ed9f771

Browse files
committed
Update error msg
1 parent ec8c476 commit ed9f771

File tree

2 files changed

+68
-14
lines changed

2 files changed

+68
-14
lines changed

src/graph_engine.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ Base.:(==)(left::VariableRef, right::VariableRef) =
883883
left.model == right.model && left.context == right.context && left.name == right.name && left.index == right.index
884884

885885
function Base.:(==)(left::VariableRef, right)
886-
@warn "Comparing Factor Graph variable ($left) with a value. This is not possible as the value of $left is not known at model construction time."
886+
@warn "Comparing Factor Graph variable `$left` with a value. This is not possible as the value of `$left` is not known at model construction time."
887887
return false
888888
end
889889
Base.:(==)(left, right::VariableRef) = right == left

test/graph_engine_tests.jl

Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -842,55 +842,109 @@ end
842842
@test xref == xref
843843
@test_logs (
844844
:warn,
845-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
845+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
846846
) xref != 1
847847
@test_logs (
848848
:warn,
849-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
849+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
850850
) 1 != xref
851851
@test_logs (
852852
:warn,
853-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
853+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
854854
) xref == 1
855855
@test_logs (
856856
:warn,
857-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
857+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
858858
) 1 == xref
859859
@test_logs (
860860
:warn,
861-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
861+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
862862
) xref > 0
863863
@test_logs (
864864
:warn,
865-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
865+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
866866
) 0 < xref
867867
@test_logs (
868868
:warn,
869-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
869+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
870870
) "something" == xref
871871
@test_logs (
872872
:warn,
873-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
873+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
874874
) 10 > xref
875875
@test_logs (
876876
:warn,
877-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
877+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
878878
) xref < 10
879879
@test_logs (
880880
:warn,
881-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
881+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
882882
) 0 <= xref
883883
@test_logs (
884884
:warn,
885-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
885+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
886886
) xref >= 0
887887
@test_logs (
888888
:warn,
889-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
889+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
890890
) xref <= 0
891891
@test_logs (
892892
:warn,
893-
"Comparing Factor Graph variable (x) with a value. This is not possible as the value of x is not known at model construction time."
893+
"Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time."
894+
) 0 >= xref
895+
896+
xref = VariableRef(model, ctx, NodeCreationOptions(), :x, (1, 2))
897+
@test_logs (
898+
:warn,
899+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
900+
) xref != 1
901+
@test_logs (
902+
:warn,
903+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
904+
) 1 != xref
905+
@test_logs (
906+
:warn,
907+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
908+
) xref == 1
909+
@test_logs (
910+
:warn,
911+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
912+
) 1 == xref
913+
@test_logs (
914+
:warn,
915+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
916+
) xref > 0
917+
@test_logs (
918+
:warn,
919+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
920+
) 0 < xref
921+
@test_logs (
922+
:warn,
923+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
924+
) "something" == xref
925+
@test_logs (
926+
:warn,
927+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
928+
) 10 > xref
929+
@test_logs (
930+
:warn,
931+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
932+
) xref < 10
933+
@test_logs (
934+
:warn,
935+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
936+
) 0 <= xref
937+
@test_logs (
938+
:warn,
939+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
940+
) xref >= 0
941+
@test_logs (
942+
:warn,
943+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
944+
) xref <= 0
945+
@test_logs (
946+
:warn,
947+
"Comparing Factor Graph variable `x[1,2]` with a value. This is not possible as the value of `x[1,2]` is not known at model construction time."
894948
) 0 >= xref
895949
end
896950

0 commit comments

Comments
 (0)