Created
January 19, 2013 08:46
-
-
Save philipbjorge/4571480 to your computer and use it in GitHub Desktop.
smackit-rb
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
class Counter | |
attr_accessor :data | |
def initialize(initial) | |
@data = initial | |
end | |
end | |
expected = [0, 1, 2, 0, 5] | |
actual = [] | |
c = Counter.new 0 | |
actual << c.data | |
c.data = 1 | |
actual << c.data | |
c.data = 2 | |
actual << c.data | |
c = c.smackit | |
actual << c.data | |
c.data = 5 | |
actual << c.data | |
assert(expected == actual, "expected and actual should match if smackit is working") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment