summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2019-09-26 22:22:13 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-09-26 22:22:13 +0900
commit74266996792c5abc598251334ad40eaf72565044 (patch)
treeb18468e0153e09647ddf7b161c8c31c90d77e8d0
parente193217b425672b758ab587573dd924d2b9d70d9 (diff)
table: add NewSingleAsPathMatch unittest
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
-rw-r--r--internal/pkg/table/policy_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/pkg/table/policy_test.go b/internal/pkg/table/policy_test.go
index c67470ef..7c2d7a64 100644
--- a/internal/pkg/table/policy_test.go
+++ b/internal/pkg/table/policy_test.go
@@ -3179,3 +3179,14 @@ func TestMultipleStatementPolicy(t *testing.T) {
localPref, _ := newPath.GetLocalPref()
assert.Equal(t, localPref, uint32(100))
}
+
+func TestNewSingleAsPathMatch(t *testing.T) {
+ r := NewSingleAsPathMatch("^65100_")
+ assert.Equal(t, r.mode, LEFT_MOST)
+ r = NewSingleAsPathMatch("_65100$")
+ assert.Equal(t, r.mode, ORIGIN)
+ r = NewSingleAsPathMatch("_65100_")
+ assert.Equal(t, r.mode, INCLUDE)
+ r = NewSingleAsPathMatch("^65100$")
+ assert.Equal(t, r.mode, ONLY)
+}