|
75 | 75 | @test _is_fallback(rrule, first(methods(rrule, (Nothing,)))) |
76 | 76 | @test _is_fallback(frule, first(methods(frule, (Tuple{}, Nothing,)))) |
77 | 77 | end |
| 78 | + |
| 79 | + @test "_rule_list" begin |
| 80 | + _rule_list = ChainRulesOverloadGeneration._rule_list |
| 81 | + @testset "should not have frules that need RuleConfig" begin |
| 82 | + old_frule_list = collect(_rule_list(frule)) |
| 83 | + function ChainRulesCore.frule( |
| 84 | + ::RuleConfig{>:Union{HasForwardsMode,HasReverseMode}}, dargs, sum, f, xs |
| 85 | + ) |
| 86 | + return 1.0, 1.0 # this will not be call so return doesn't matter |
| 87 | + end |
| 88 | + # New rule should not have appeared |
| 89 | + @test collect(_rule_list(frule)) == old_frule_list |
| 90 | + end |
| 91 | + |
| 92 | + @testset "should not have rrules that need RuleConfig" begin |
| 93 | + old_rrule_list = collect(_rule_list(rrule)) |
| 94 | + function ChainRulesCore.rrule( |
| 95 | + ::RuleConfig{>:Union{HasForwardsMode,HasReverseMode}}, sum, f, xs |
| 96 | + ) |
| 97 | + return 1.0, x->(x,x,x) # this will not be call so return doesn't matter |
| 98 | + end |
| 99 | + # New rule should not have appeared |
| 100 | + @test collect(_rule_list(rrule)) == old_rrule_list |
| 101 | + end |
| 102 | + end |
78 | 103 | end |
0 commit comments