Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
[#46] Added examples for Toggle
Browse files Browse the repository at this point in the history
One 'simple' example which uses 000 and 1011

One regular example with the output bada55
  • Loading branch information
Gman98ish committed Oct 31, 2017
1 parent 161495f commit cb68ae1
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion example_byteslice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,25 @@ func ExampleReverse() {

func ExampleLPad() {
data := []byte{0x55, 0xDA, 0xBA}

fmt.Printf("%x\n", LPad(data, 5, 0x22))
// Output: 222255daba
}

func ExampleToggle() {
data := []byte{0xbb, 0xdb, 0x54}
toggle := []byte{0x01, 0x01, 0x01}

output, _ := Toggle(data, toggle)
fmt.Printf("%x\n", output)
// Output: bada55
}

func ExampleToggle_simple() {
data := []byte{0x00, 0x01, 0x00}
toggle := []byte{0x01, 0x00, 0x01}

output, _ := Toggle(data, toggle)
fmt.Printf("%x\n", output)
// Output: 010101
}

0 comments on commit cb68ae1

Please sign in to comment.