Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jhsu/kata-21
Code Kata 21 from http://codekata.pragprog.com/2007/01/kata_twenty_one.html
https://github.com/jhsu/kata-21
Last synced: 2 days ago
JSON representation
Code Kata 21 from http://codekata.pragprog.com/2007/01/kata_twenty_one.html
- Host: GitHub
- URL: https://github.com/jhsu/kata-21
- Owner: jhsu
- Created: 2012-06-30T00:20:51.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-07-10T17:42:36.000Z (over 12 years ago)
- Last Synced: 2024-12-20T21:13:11.225Z (3 days ago)
- Language: Ruby
- Size: 102 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# Code Kata 21
Attempted by Joseph Hsu
[![Build Status](https://secure.travis-ci.org/jhsu/kata-21.png)](http://travis-ci.org/jhsu/kata-21)
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/jhsu/kata-21)
Kata from http://codekata.pragprog.com/2007/01/kata_twenty_one.html
list = List.new
assert_nil(list.find("fred"))
list.add("fred")
assert_equal("fred", list.find("fred").value())
assert_nil(list.find("wilma"))
list.add("wilma")
assert_equal("fred", list.find("fred").value())
assert_equal("wilma", list.find("wilma").value())
assert_equal(["fred", "wilma"], list.values())
list = List.new
list.add("fred")
list.add("wilma")
list.add("betty")
list.add("barney")
assert_equal(["fred", "wilma", "betty", "barney"], list.values())
list.delete(list.find("wilma"))
assert_equal(["fred", "betty", "barney"], list.values())
list.delete(list.find("barney"))
assert_equal(["fred", "betty"], list.values())
list.delete(list.find("fred"))
assert_equal(["betty"], list.values())
list.delete(list.find("betty"))
assert_equal([], list.values())
## Running tests
1. Install gems using `bundle install` (if on non-mac, run `bundle install --without=mac`)
2. run `rake`