Skip to content

Commit

Permalink
Add Object Identifier Test
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Bachschwell <[email protected]>
  • Loading branch information
s00500 committed Apr 29, 2024
1 parent d9c2bde commit fc53e0c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ber_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ func TestString(t *testing.T) {
}
}

func TestEncodeDecodeOID(t *testing.T) {
for _, v := range []string{"0.1", "1.1", "2.3", "0.4", "0.4.5.1888", "0.10.5.1888.234.324234"} {
enc, err := encodeOID(v)
if err != nil {
t.Errorf("error on encoding object identifier when encoding %s: %v", v, err)
}
parsed, err := parseObjectIdentifier(enc)
if err != nil {
t.Errorf("error on parsing object identifier when parsing %s: %v", v, err)
}
t.Log(enc)
t.Log(OIDToString(parsed))
if v != OIDToString(parsed) {
t.Error("encoded object identifier did not match parsed")
}
}
}

func TestSequenceAndAppendChild(t *testing.T) {
values := []string{
"HIC SVNT LEONES",
Expand Down

0 comments on commit fc53e0c

Please sign in to comment.