|
814 | 814 | end |
815 | 815 | end |
816 | 816 |
|
| 817 | +@testitem "`VariableRef` comparison" begin |
| 818 | + import GraphPPL: |
| 819 | + VariableRef, |
| 820 | + makevarref, |
| 821 | + getcontext, |
| 822 | + getifcreated, |
| 823 | + unroll, |
| 824 | + ProxyLabel, |
| 825 | + NodeLabel, |
| 826 | + proxylabel, |
| 827 | + NodeCreationOptions, |
| 828 | + VariableKindRandom, |
| 829 | + VariableKindData, |
| 830 | + getproperties, |
| 831 | + is_kind, |
| 832 | + MissingCollection, |
| 833 | + getorcreate! |
| 834 | + |
| 835 | + using Distributions |
| 836 | + |
| 837 | + include("testutils.jl") |
| 838 | + |
| 839 | + model = create_test_model() |
| 840 | + ctx = getcontext(model) |
| 841 | + xref = VariableRef(model, ctx, NodeCreationOptions(), :x, (nothing,)) |
| 842 | + @test xref == xref |
| 843 | + @test_throws( |
| 844 | + "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 | + xref != 1 |
| 846 | + ) |
| 847 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." 1 != |
| 848 | + xref |
| 849 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." xref == |
| 850 | + 1 |
| 851 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." 1 == |
| 852 | + xref |
| 853 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." xref > |
| 854 | + 0 |
| 855 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." 0 < |
| 856 | + xref |
| 857 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." "something" == |
| 858 | + xref |
| 859 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." 10 > |
| 860 | + xref |
| 861 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." xref < |
| 862 | + 10 |
| 863 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." 0 <= |
| 864 | + xref |
| 865 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." xref >= |
| 866 | + 0 |
| 867 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." xref <= |
| 868 | + 0 |
| 869 | + @test_throws "Comparing Factor Graph variable `x` with a value. This is not possible as the value of `x` is not known at model construction time." 0 >= |
| 870 | + xref |
| 871 | + |
| 872 | + xref = VariableRef(model, ctx, NodeCreationOptions(), :x, (1, 2)) |
| 873 | + @test_throws "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." xref != |
| 874 | + 1 |
| 875 | + @test_throws "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." 1 != |
| 876 | + xref |
| 877 | + @test_throws "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." xref == |
| 878 | + 1 |
| 879 | + @test_throws "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." 1 == |
| 880 | + xref |
| 881 | + @test_throws "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." xref > |
| 882 | + 0 |
| 883 | + @test_throws "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." 0 < |
| 884 | + xref |
| 885 | + @test_throws "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." "something" == |
| 886 | + xref |
| 887 | + @test_throws "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." 10 > |
| 888 | + xref |
| 889 | + @test_throws "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." xref < |
| 890 | + 10 |
| 891 | + @test_throws "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." 0 <= |
| 892 | + xref |
| 893 | + @test_throws "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." xref >= |
| 894 | + 0 |
| 895 | + @test_throws "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." xref <= |
| 896 | + 0 |
| 897 | + @test_throws "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." 0 >= |
| 898 | + xref |
| 899 | +end |
| 900 | + |
817 | 901 | @testitem "NodeLabel properties" begin |
818 | 902 | import GraphPPL: NodeLabel |
819 | 903 |
|
|
0 commit comments