Guest User

Untitled

a guest
Jul 15th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. describe Plate do
  2.  
  3. before :each do
  4. @plate = Plate.new(8, 12)
  5. end
  6.  
  7. it "should be empty on creation" do
  8. @plate.each do |value|
  9. value.should be nil
  10. end
  11. end
  12.  
  13. it "should also be empty by using empty?" do
  14. @plate.empty?.should be true
  15. end
  16.  
  17. it "should return indices through iteration" do
  18. i = 0
  19. j = 0
  20. @plate.each_with_coordinate do |row, column, e|
  21. row.should be i
  22. column.should be j
  23. if j == 11
  24. j = 0
  25. i = i.succ
  26. else
  27. j = j.succ
  28. end
  29. end
  30. end
  31.  
  32. it "should store data safely through accessors" do
  33. test_data = Array.new(96) {|e| e = rand}
  34. i = 0
  35. for row in 0..7
  36. for column in 0..11
  37. @plate[row, column] = test_data[i]
  38. i = i.succ
  39. end
  40. end
  41.  
  42. i = 0
  43. for row in 0..7
  44. for column in 0..11
  45. @plate[row, column].should be test_data[i]
  46. i = i.succ
  47. end
  48. end
  49. end
  50.  
  51. it "should not report empty with data" do
  52. @plate[0, 0] = rand
  53. @plate.empty?.should_not be true
  54. end
  55.  
  56. it "should translate from excel style to cartesian coordinates" do
  57. # i seem to be screwing this up, save for later
  58. end
  59. end
Add Comment
Please, Sign In to add comment