From 5afca3330bee1e587b4fcba6d98837ae316bc2ea Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sun, 18 Nov 2012 09:10:28 +0100 Subject: [PATCH] Add tests and uppercase output of L64 --- parse_test.go | 25 +++++++++++++++++++++++++ types.go | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/parse_test.go b/parse_test.go index 1507674e..e2872004 100644 --- a/parse_test.go +++ b/parse_test.go @@ -634,3 +634,28 @@ func TestParseBackslash(t *testing.T) { t.Logf("Parsed %s\n", r.String()) } } + +func TestILNP(t *testing.T) { + tests := []string{ + "host1.example.com. IN NID 10 0014:4fff:ff20:ee64", + "host1.example.com. IN NID 20 0015:5fff:ff21:ee65", + "host2.example.com. IN NID 10 0016:6fff:ff22:ee66", + "host1.example.com. IN L32 10 10.1.02.0", + "host1.example.com. IN L32 20 10.1.04.0", + "host2.example.com. IN L32 10 10.1.08.0", + "host1.example.com. IN L64 10 2001:0DB8:1140:1000", + "host1.example.com. IN L64 20 2001:0DB8:2140:2000", + "host2.example.com. IN L64 10 2001:0DB8:4140:4000", + "host1.example.com. IN LP 10 l64-subnet1.example.com.", + "host1.example.com. IN LP 10 l64-subnet2.example.com.", + "host1.example.com. IN LP 20 l32-subnet1.example.com.", + } + for _, t1 := range tests { + r, e := NewRR(t1) + if e != nil { + t.Fatalf("An error occured: %s\n", e.Error()) + } else { + t.Logf("%s\n", r.String()) + } + } +} diff --git a/types.go b/types.go index 2081ec09..663f7160 100644 --- a/types.go +++ b/types.go @@ -1434,7 +1434,7 @@ func (rr *RR_L64) Header() *RR_Header { func (rr *RR_L64) String() string { s := rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) - node := fmt.Sprintf("%0.16x", rr.Locator64) + node := fmt.Sprintf("%0.16X", rr.Locator64) s += node[0:3] + ":" + node[4:7] + ":" + node[8:11] + ":" + node[12:15] return s }