From 89d2130306fff569eef78fbf9176f19897fd0fd9 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 25 Apr 2012 08:14:11 -0400 Subject: [PATCH] add test for save_chunk fix --- test/grid_io_test.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/grid_io_test.rb b/test/grid_io_test.rb index cee9fad..3e58c56 100644 --- a/test/grid_io_test.rb +++ b/test/grid_io_test.rb @@ -122,6 +122,35 @@ class GridIOTest < Test::Unit::TestCase end end + context "Writing" do + setup do + @filename = 'test' + @length = 50000 + @times = 10 + end + + should "correctly write multiple chunks from mutiple writes" do + file = GridIO.new(@files, @chunks, @filename, 'w') + + @times.times do + file.write("1" * @length) + end + + file.close + + file = GridIO.new(@files, @chunks, @filename, 'r') + + total_size = 0 + while !file.eof? + total_size += file.read(@length).length + end + + file.close + + assert_equal total_size, @times * @length + end + end + context "Seeking" do setup do @filename = 'test'