|
10 | 10 | import ReactiveMP: float_tolerance, float_tolerance! |
11 | 11 | import ReactiveMP: extra_float_types, extra_float_types! |
12 | 12 | import ReactiveMP: test_rules_parse_configuration |
| 13 | + import ReactiveMP: rule_macro_convert_to_expr |
13 | 14 |
|
14 | 15 | @testset "TestRulesConfiguration" begin |
15 | 16 |
|
|
59 | 60 | @test_throws ErrorException test_rules_parse_configuration(:configuration, :([options = value = broken])) |
60 | 61 |
|
61 | 62 | for name in (:configuration, :blabla), |
62 | | - check in (true, false), atol in (1e-4, :([Float64 => 1e-11, Float32 => 1e-4])), |
| 63 | + check in (true, false), |
| 64 | + atol in (1e-4, :([Float64 => 1e-11, Float32 => 1e-4])), |
63 | 65 | extra_types in (:([Float64]), :([Float32, BigFloat])) |
64 | 66 |
|
65 | 67 | expression = test_rules_parse_configuration(name, :([check_type_promotion = $check, atol = $atol, extra_float_types = $extra_types])) |
|
95 | 97 | import ReactiveMP: TestRuleEntryInputSpecification |
96 | 98 |
|
97 | 99 | let spec = TestRuleEntryInputSpecification([:m_x => 1], nothing) |
98 | | - @test convert(Expr, spec) == :((m_x = 1,)) |
| 100 | + @test rule_macro_convert_to_expr(spec) == :((m_x = 1,)) |
99 | 101 | end |
100 | 102 |
|
101 | 103 | let spec = TestRuleEntryInputSpecification([:q_x => 1, :m_y => :(Normal(1.0, 1.0))], :(Meta(2))) |
102 | | - @test convert(Expr, spec) == :((q_x = 1, m_y = Normal(1.0, 1.0), meta = Meta(2))) |
| 104 | + @test rule_macro_convert_to_expr(spec) == :((q_x = 1, m_y = Normal(1.0, 1.0), meta = Meta(2))) |
103 | 105 | end |
104 | 106 | end |
105 | 107 |
|
|
120 | 122 | import ReactiveMP: TestRuleEntry |
121 | 123 |
|
122 | 124 | let spec = TestRuleEntry(TestRuleEntryInputSpecification([:m_x => 1], nothing), :(Normal(0.0, 3.0))) |
123 | | - @test convert(Expr, spec) == :((input = (m_x = 1,), output = Normal(0.0, 3.0))) |
| 125 | + @test rule_macro_convert_to_expr(spec) == :((input = (m_x = 1,), output = Normal(0.0, 3.0))) |
124 | 126 | end |
125 | 127 |
|
126 | 128 | let spec = TestRuleEntry(TestRuleEntryInputSpecification([:q_x => 1, :m_y => :(Normal(1.0, 1.0))], :(Meta(2))), :(Gamma(2.0, 3.0))) |
127 | | - @test convert(Expr, spec) == :((input = (q_x = 1, m_y = Normal(1.0, 1.0), meta = Meta(2)), output = Gamma(2.0, 3.0))) |
| 129 | + @test rule_macro_convert_to_expr(spec) == :((input = (q_x = 1, m_y = Normal(1.0, 1.0), meta = Meta(2)), output = Gamma(2.0, 3.0))) |
128 | 130 | end |
129 | 131 | end |
130 | 132 |
|
|
176 | 178 |
|
177 | 179 | for m in (1, :(Normal(0.0, 1.0))), v in (2, Gamma(2.0, 3.0)), output in (3, :(Normal(2.0, 3.0))), eltype in (:Float32, Float64) |
178 | 180 | let test_entry = TestRuleEntry(TestRuleEntryInputSpecification([:m => m, :v => v], :(Meta(1))), output) |
179 | | - modified_inputs = map(e -> convert(Expr, e), test_rules_convert_paramfloattype_for_test_entry(test_entry, eltype)) |
| 181 | + modified_inputs = map(e -> rule_macro_convert_to_expr(e), test_rules_convert_paramfloattype_for_test_entry(test_entry, eltype)) |
180 | 182 |
|
181 | 183 | modified_m = :(ReactiveMP.BayesBase.convert_paramfloattype($eltype, $m)) |
182 | 184 | modified_v = :(ReactiveMP.BayesBase.convert_paramfloattype($eltype, $v)) |
|
0 commit comments