diff options
| author | Shulhan <ms@kilabit.info> | 2025-01-22 23:27:48 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-01-23 00:00:38 +0700 |
| commit | 7f52c92fab6a49149643feeb9b3e5c06ef249ec1 (patch) | |
| tree | da5afba93e5a74bc89bee33a2eff4159a1323768 /lib/bytes/bytes_example_test.go | |
| parent | 8ad0d7cc01c08f60402d3d18df5dea13bfd94ece (diff) | |
| download | pakakeh.go-7f52c92fab6a49149643feeb9b3e5c06ef249ec1.tar.xz | |
all: replace "lib/bytes.ReadXxx" with standard library
Package "encoding/binary" from standard library support reading integer
from bytes using BigEndian, LittleEndian variables.
Diffstat (limited to 'lib/bytes/bytes_example_test.go')
| -rw-r--r-- | lib/bytes/bytes_example_test.go | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/bytes/bytes_example_test.go b/lib/bytes/bytes_example_test.go index 5ca7a1ea..670a28c6 100644 --- a/lib/bytes/bytes_example_test.go +++ b/lib/bytes/bytes_example_test.go @@ -168,46 +168,6 @@ func ExampleReadHexByte() { // 0 false } -func ExampleReadInt16() { - fmt.Println(libbytes.ReadInt16([]byte{0x01, 0x02, 0x03, 0x04}, 3)) // x is out of range. - fmt.Println(libbytes.ReadInt16([]byte{0x01, 0x02, 0x03, 0x04}, 0)) // 0x0102 - fmt.Println(libbytes.ReadInt16([]byte{0x01, 0x02, 0xf0, 0x04}, 2)) // 0xf004 - // Output: - // 0 - // 258 - // -4092 -} - -func ExampleReadInt32() { - fmt.Println(libbytes.ReadInt32([]byte{0x01, 0x02, 0x03, 0x04}, 1)) // x is out of range. - fmt.Println(libbytes.ReadInt32([]byte{0x01, 0x02, 0x03, 0x04}, 0)) // 0x01020304 - fmt.Println(libbytes.ReadInt32([]byte{0xf1, 0x02, 0x03, 0x04}, 0)) // 0xf1020304 - // Output: - // 0 - // 16909060 - // -251526396 -} - -func ExampleReadUint16() { - fmt.Println(libbytes.ReadUint16([]byte{0x01, 0x02, 0xf0, 0x04}, 3)) // x is out of range. - fmt.Println(libbytes.ReadUint16([]byte{0x01, 0x02, 0xf0, 0x04}, 0)) // 0x0102 - fmt.Println(libbytes.ReadUint16([]byte{0x01, 0x02, 0xf0, 0x04}, 2)) // 0xf004 - // Output: - // 0 - // 258 - // 61444 -} - -func ExampleReadUint32() { - fmt.Println(libbytes.ReadUint32([]byte{0x01, 0x02, 0x03, 0x04}, 1)) // x is out of range. - fmt.Println(libbytes.ReadUint32([]byte{0x01, 0x02, 0x03, 0x04}, 0)) // 0x01020304 - fmt.Println(libbytes.ReadUint32([]byte{0xf1, 0x02, 0x03, 0x04}, 0)) // 0xf1020304 - // Output: - // 0 - // 16909060 - // 4043440900 -} - func ExampleRemoveSpaces() { var ( in = []byte(" a\nb\tc d\r") |
