Created
April 24, 2020 08:54
-
-
Save whiz25/b86a04a76b1d3a4958180950bbc0fe91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- [ ] bubble_sort_by method is implemented and working (Screenshot from Odin) | |
- [ ] sorts an array of numbers in increasing order | |
```ruby | |
unsorted = (1..10).to_a.reverse! | |
bubble_sort(unsorted) == unsorted.sort # should return true | |
``` | |
- [ ] sorts an array by accepting a block | |
```ruby | |
unsorted = %w[hi hello hey] | |
bubble_sort_by(unsorted) { |left, right| left.length - right.length } == %w[hi hey hello] # should return true | |
``` | |
- [ ] raises an error if block is not given | |
```ruby | |
bubble_sort_by(unsorted) == raise_error # should return true | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment