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

Examples for Toogle #59

Merged
merged 1 commit into from
Nov 1, 2017
Merged

Examples for Toogle #59

merged 1 commit into from
Nov 1, 2017

Conversation

Gman98ish
Copy link
Contributor

I've added an example for toogle, but I thought it might be clearer if I didn't use bada55 as the output, what do you think? Also, should Toogle be Toggle (not sure if that's a daft question).

@rlespinasse
Copy link
Owner

Rebase your work upon the latest commit on master, a fix have been made on Toogle typo #65

@rlespinasse rlespinasse self-assigned this Oct 31, 2017
Copy link
Owner

@rlespinasse rlespinasse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set a example with bada55 output named ExampleToggle and another one with your version named ExampleToggle_simple

data := []byte{0x00, 0x01, 0x00}
toogle := []byte{0x01, 0x01, 0x00}
fmt.Printf("%x\n", Toogle(data, toogle))
// Output: 010101
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output is 010000, not 010101

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling dca80e7 on Gman98ish:master into 97bd93e on rlespinasse:master.

@Gman98ish
Copy link
Contributor Author

Thanks for the feedback. I've added a simple example. If you want, I can squash the last 6 commits, into one. Just to avoid cluttering commit history

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling cad6ca8 on Gman98ish:master into 0dca882 on rlespinasse:master.


output, _ := Toggle(data, toggle)
fmt.Printf("%x\n", output)
// Output: 535155510404
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output need to be bada55 here, not a byte slice of 6 bytes, so the data and toogle need to be both a byte slice of 3 bytes.
[]byte("bada55") are not the same as []byte(0xba, 0xda, 0x55)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the slice to not use a string, I've also added two examples, one simple, one regular one. I've also squashed the commits down to one so as not to clutter commit history

@Gman98ish Gman98ish force-pushed the master branch 2 times, most recently from 2d2549a to 1d56d10 Compare October 31, 2017 22:41
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 1d56d10 on Gman98ish:master into 0dca882 on rlespinasse:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 1d56d10 on Gman98ish:master into 0dca882 on rlespinasse:master.

One 'simple' example which uses 000 and 1011

One regular example with the output bada55
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling cb68ae1 on Gman98ish:master into 0dca882 on rlespinasse:master.

@rlespinasse rlespinasse merged commit ee6db2c into rlespinasse:master Nov 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants