Skip to content
Snippets Groups Projects
Commit 58e9c70f authored by Christoph Petrausch's avatar Christoph Petrausch
Browse files

provide an constructor for TermCondition

parent c94eb138
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,13 @@ type TermCondition struct {
routeFilters []*RouteFilter
}
func NewTermCondition(prefixLists []*PrefixList, routeFilters []*RouteFilter) *TermCondition {
return &TermCondition{
prefixLists: prefixLists,
routeFilters: routeFilters,
}
}
func (f *TermCondition) Matches(p net.Prefix, pa *route.Path) bool {
return f.matchesAnyPrefixList(p) || f.machtchesAnyRouteFilter(p)
}
......
......@@ -109,10 +109,10 @@ func TestMatches(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(te *testing.T) {
f := &TermCondition{
prefixLists: test.prefixLists,
routeFilters: test.routeFilters,
}
f := NewTermCondition(
test.prefixLists,
test.routeFilters,
)
assert.Equal(te, test.expected, f.Matches(test.prefix, &route.Path{}))
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment