diff options
| author | Shulhan <ms@kilabit.info> | 2024-12-28 16:22:29 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-12-28 16:46:59 +0700 |
| commit | c1aab5c376dfa1845b839f1c4b9876a1412a8d24 (patch) | |
| tree | a4d191420f52a3f1aad25c4609ced5e03036e5ab /lib/bytes/bytes_example_test.go | |
| parent | 4003b6359747f6e43357e4bf190d4e71a66ec796 (diff) | |
| download | pakakeh.go-c1aab5c376dfa1845b839f1c4b9876a1412a8d24.tar.xz | |
lib/bytes: split the hexdump related functions to separate package
Package hexdump implements reading and writing bytes from and into
hexadecimal number.
It support parsing output from hexdump(1) tool.
Diffstat (limited to 'lib/bytes/bytes_example_test.go')
| -rw-r--r-- | lib/bytes/bytes_example_test.go | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/lib/bytes/bytes_example_test.go b/lib/bytes/bytes_example_test.go index 0c2fbf49..6615f36d 100644 --- a/lib/bytes/bytes_example_test.go +++ b/lib/bytes/bytes_example_test.go @@ -5,9 +5,7 @@ package bytes_test import ( - "bytes" "fmt" - "log" "math" "git.sr.ht/~shulhan/pakakeh.go/lib/ascii" @@ -305,35 +303,6 @@ func ExampleMergeSpaces() { // a } -func ExampleParseHexDump() { - var ( - in = []byte("0000000 6548 6c6c 2c6f 7720 726f 646c 0021") - - out []byte - err error - ) - - out, err = libbytes.ParseHexDump(in, false) - if err != nil { - log.Fatal(err) - } - - fmt.Printf(`%s`, libbytes.TrimNull(out)) - // Output: - // Hello, world! -} - -func ExamplePrintHex() { - title := "PrintHex" - data := []byte("Hello, world !") - libbytes.PrintHex(title, data, 5) - // Output: - // PrintHex - // 0 - 48 65 6C 6C 6F || H e l l o - // 5 - 2C 20 77 6F 72 || , . w o r - // 10 - 6C 64 20 21 || l d . ! -} - func ExampleReadHexByte() { fmt.Println(libbytes.ReadHexByte([]byte{}, 0)) fmt.Println(libbytes.ReadHexByte([]byte("x0"), 0)) @@ -492,22 +461,6 @@ func ExampleWordIndexes() { // [] } -func ExampleDumpPrettyTable() { - var ( - data = []byte{1, 2, 3, 'H', 'e', 'l', 'l', 'o', 254, 255} - bb bytes.Buffer - ) - - libbytes.DumpPrettyTable(&bb, `DumpPrettyTable`, data) - fmt.Println(bb.String()) - // Output: - // DumpPrettyTable - // | 0 1 2 3 4 5 6 7 | 01234567 | 0 1 2 3 4 5 6 7 | - // | 8 9 A B C D E F | 89ABCDEF | 8 9 A B C D E F | - // 0x00000000| 01 02 03 48 65 6c 6c 6f | ...Hello | 1 2 3 72 101 108 108 111 |0 - // 0x00000008| fe ff | .. | 254 255 |8 -} - func ExampleWriteUint16() { data := []byte("Hello, world!") |
