Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe Plate do
- before :each do
- @plate = Plate.new(8, 12)
- end
- it "should be empty on creation" do
- @plate.each do |value|
- value.should be nil
- end
- end
- it "should also be empty by using empty?" do
- @plate.empty?.should be true
- end
- it "should return indices through iteration" do
- i = 0
- j = 0
- @plate.each_with_coordinate do |row, column, e|
- row.should be i
- column.should be j
- if j == 11
- j = 0
- i = i.succ
- else
- j = j.succ
- end
- end
- end
- it "should store data safely through accessors" do
- test_data = Array.new(96) {|e| e = rand}
- i = 0
- for row in 0..7
- for column in 0..11
- @plate[row, column] = test_data[i]
- i = i.succ
- end
- end
- i = 0
- for row in 0..7
- for column in 0..11
- @plate[row, column].should be test_data[i]
- i = i.succ
- end
- end
- end
- it "should not report empty with data" do
- @plate[0, 0] = rand
- @plate.empty?.should_not be true
- end
- it "should translate from excel style to cartesian coordinates" do
- # i seem to be screwing this up, save for later
- end
- end
Add Comment
Please, Sign In to add comment