aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-06-28 02:13:57 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-06-28 02:13:57 +0200
commit986aaa832429b4cfb012a622f8f4122a3a682edd (patch)
treec30feec5b228abd067b595fb1948382313f12d96
parentcdeb83a9f88402484519fa2571234cfab7517353 (diff)
Update Example
-rw-r--r--ber/class_test.go27
1 files changed, 17 insertions, 10 deletions
diff --git a/ber/class_test.go b/ber/class_test.go
index a7b8e1d..252d7ae 100644
--- a/ber/class_test.go
+++ b/ber/class_test.go
@@ -3,18 +3,25 @@ package ber
import "fmt"
func ExampleIdent() {
- b := []byte{0x60, 0xA1, 0x02, 0x30, 0x0A, 0x80, 0x7E, 0x04}
+ b := []byte{0x60, 0xA1, 0x02, 0x30, 0x0A, 0x80, 0x7E, 0x04, 0xBE}
for _, v := range b {
c, k, t := Ident(v)
- fmt.Printf("0x%.2X: %v %v %v - 0x%.2X\n", v, c, k, t, byte(t))
+ if c == Universal {
+ fmt.Printf("0x%.2X: %v %v %v\n",
+ v, c, k, t)
+ } else {
+ fmt.Printf("0x%.2X: %v %v 0x%.2X\n",
+ v, c, k, byte(t))
+ }
}
// Output:
- // 0x60: Application Constructed End-of-Content - 0x00
- // 0xA1: Context-specific Constructed Boolean - 0x01
- // 0x02: Universal Primitive Integer - 0x02
- // 0x30: Universal Constructed Sequence / Of - 0x10
- // 0x0A: Universal Primitive Enumerated - 0x0A
- // 0x80: Context-specific Primitive End-of-Content - 0x00
- // 0x7E: Application Constructed BMP String - 0x1E
- // 0x04: Universal Primitive Octet String - 0x04
+ // 0x60: Application Constructed 0x00
+ // 0xA1: Context-specific Constructed 0x01
+ // 0x02: Universal Primitive Integer
+ // 0x30: Universal Constructed Sequence / Of
+ // 0x0A: Universal Primitive Enumerated
+ // 0x80: Context-specific Primitive 0x00
+ // 0x7E: Application Constructed 0x1E
+ // 0x04: Universal Primitive Octet String
+ // 0xBE: Context-specific Constructed 0x1E
}