Permalink
Browse files

snappy specs

  • Loading branch information...
1 parent b46645c commit 2a359913dedc17ae0a6cb918b9bb1bac3ca13486 @igrigorik committed Mar 27, 2011
Showing with 26 additions and 0 deletions.
  1. +26 −0 spec/snappy_spec.rb
View
@@ -0,0 +1,26 @@
+require 'rspec'
+require 'snappy'
+
+describe Snappy do
+ it 'should compress data' do
+ lambda do
+ Snappy.compress('abcdefg')
+ end.should_not raise_error
+ end
+
+ it 'should uncompress data' do
+ lambda do
+ Snappy.uncompress(Snappy.compress('abcdefg'))
+ end.should_not raise_error
+ end
+
+ it 'should roundtrip the data' do
+ original = 'abcdefg' * 100
+
+ compressed = Snappy.compress(original)
+ uncompressed = Snappy.uncompress(compressed)
+
+ original.should == uncompressed
+ compressed.size.should < original.size
+ end
+end

0 comments on commit 2a35991

Please sign in to comment.