package birdfmt import "testing" func TestSummarizeProtocolsOutput(t *testing.T) { sample := `name proto table state since info device1 Device --- up 10:00:00 uplink BGP --- start 10:00:01 Established ` s := SummarizeProtocolsOutput(sample) if s.BGPSessionsTotal != 1 || s.BGPEstablished != 1 { t.Fatalf("got %+v", s) } } func TestSummarizeProtocolsOutput_evoBGPNameNotCountedAsBGP(t *testing.T) { sample := `Name Proto Table State Since Info evobgp_prefixes_v4 Static master4 up 17:32:14.631 evobgp_prefixes_v6 Static master6 up 17:32:14.631 ` s := SummarizeProtocolsOutput(sample) if s.BGPSessionsTotal != 0 || s.BGPEstablished != 0 { t.Fatalf("evobgp_* static names must not match substring bgp: got %+v", s) } }