SEAT: Setup, Exercise, Assert, Teardown
Setup: Setup any objects necessary for tests to run.
Exercise: Make any calls for invoke specific behavior that is necessary for testing a feature or aspect of our program.
Trees Inventory | Open Data - City of Santa Monica Trello https://tree-map.nycgovparks.org/#borough-4
require 'minitest/autorun' | |
require_relative 'currency' | |
class CurrencyTest < Minitest::Test | |
def test_invalid_currency | |
assert_raises(ArgumentError) { to_currency("453&$*#") } | |
end | |
def test_dollar_format | |
assert_equal '$', to_currency("5")[0] |
class CircularBuffer | |
class BufferEmptyException < IOError; end | |
class BufferFullException < IOError; end | |
attr_reader :data | |
def initialize(size) | |
@data = Array.new(size) | |
@reader = BufferReader.new | |
@writer = BufferWriter.new | |
end |
class CircularBuffer | |
class BufferEmptyException < IOError; end | |
class BufferFullException < IOError; end | |
attr_reader :data | |
def initialize(size) | |
@data = Array.new(size) | |
@read_index = 0 | |
@write_index = 0 | |
end |