more debugging
This commit is contained in:
parent
c706e79813
commit
2500996ce4
|
@ -41,55 +41,69 @@ class CursorTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_refill_via_get_more
|
def test_refill_via_get_more
|
||||||
1000.times { |i|
|
begin
|
||||||
@@coll.insert('a' => i)
|
assert_equal 1, @@coll.count
|
||||||
}
|
1000.times { |i|
|
||||||
|
assert_equal 1 + i, @@coll.count
|
||||||
|
@@coll.insert('a' => i)
|
||||||
|
}
|
||||||
|
|
||||||
assert_equal 1001, @@coll.count
|
assert_equal 1001, @@coll.count
|
||||||
count = 0
|
count = 0
|
||||||
@@coll.find.each { |obj|
|
@@coll.find.each { |obj|
|
||||||
count += obj['a']
|
count += obj['a']
|
||||||
}
|
}
|
||||||
assert_equal 1001, @@coll.count
|
assert_equal 1001, @@coll.count
|
||||||
|
|
||||||
# do the same thing again for debugging
|
# do the same thing again for debugging
|
||||||
assert_equal 1001, @@coll.count
|
assert_equal 1001, @@coll.count
|
||||||
count2 = 0
|
count2 = 0
|
||||||
@@coll.find.each { |obj|
|
@@coll.find.each { |obj|
|
||||||
count2 += obj['a']
|
count2 += obj['a']
|
||||||
}
|
}
|
||||||
assert_equal 1001, @@coll.count
|
assert_equal 1001, @@coll.count
|
||||||
|
|
||||||
assert_equal count, count2
|
assert_equal count, count2
|
||||||
assert_equal 499501, count
|
assert_equal 499501, count
|
||||||
|
rescue Test::Unit::AssertionFailedError => ex
|
||||||
|
p @@db.collection_names
|
||||||
|
Process.exit 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_refill_via_get_more_alt_coll
|
def test_refill_via_get_more_alt_coll
|
||||||
coll = @@db.collection('test-alt-coll')
|
begin
|
||||||
coll.clear
|
coll = @@db.collection('test-alt-coll')
|
||||||
coll.insert('a' => 1) # collection not created until it's used
|
coll.clear
|
||||||
|
coll.insert('a' => 1) # collection not created until it's used
|
||||||
|
assert_equal 1, coll.count
|
||||||
|
|
||||||
1000.times { |i|
|
1000.times { |i|
|
||||||
coll.insert('a' => i)
|
assert_equal 1 + i, coll.count
|
||||||
}
|
coll.insert('a' => i)
|
||||||
|
}
|
||||||
|
|
||||||
assert_equal 1001, coll.count
|
assert_equal 1001, coll.count
|
||||||
count = 0
|
count = 0
|
||||||
coll.find.each { |obj|
|
coll.find.each { |obj|
|
||||||
count += obj['a']
|
count += obj['a']
|
||||||
}
|
}
|
||||||
assert_equal 1001, coll.count
|
assert_equal 1001, coll.count
|
||||||
|
|
||||||
# do the same thing again for debugging
|
# do the same thing again for debugging
|
||||||
assert_equal 1001, coll.count
|
assert_equal 1001, coll.count
|
||||||
count2 = 0
|
count2 = 0
|
||||||
coll.find.each { |obj|
|
coll.find.each { |obj|
|
||||||
count2 += obj['a']
|
count2 += obj['a']
|
||||||
}
|
}
|
||||||
assert_equal 1001, coll.count
|
assert_equal 1001, coll.count
|
||||||
|
|
||||||
assert_equal count, count2
|
assert_equal count, count2
|
||||||
assert_equal 499501, count
|
assert_equal 499501, count
|
||||||
|
rescue Test::Unit::AssertionFailedError => ex
|
||||||
|
p @@db.collection_names
|
||||||
|
Process.exit 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_close_after_query_sent
|
def test_close_after_query_sent
|
||||||
|
|
Loading…
Reference in New Issue