Sha256: 3bc0410de1bd1dd9a52426ee872b2c75899acf496b0109b9fa6a1312067ef7ad
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
require 'sane' require_rel '../ext/google_hash.so' require 'spec/autorun' describe GoogleHashSmall do before do @subject = GoogleHashSmall.new end it "should be instantiable" do # nothing end it "should allow you to set a key" do @subject[33] = 'abc' end it "should allow you to retrieve a key" do @subject[33] = 'abc' @subject[33].should == 'abc' end it "should allow you to iterate" do @subject[33] = 'abc' @subject[44] = 'def' all_got = [] @subject.each{|k, v| all_got << v } assert all_got.sort == ['abc', 'def'] end it "should have all the methods desired" do # guess these could all be tests, themselves... @subject.each_key {} @subject.each_value{} @subject.each{} @subject.delete(33) @subject.clear @subject.length.should == 0 end it "should not leak" do raise 'not done' end it "should have better namespace" do GoogleHash::Space end it "should disallow non numeric keys" do @subject['33'].should raise_exception end it "should allow for non numeric keys" do # todo instantiate new type here... # todo allow for floats, ints, symbols, strings [freeze 'em] # wait are any of those actually useful tho? @subject['33'] = 33 @subject['33'].should == 33 end # todo do the non sparse, too... it "should return nil if key is absent" do @subject[33].should be_nil end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
google_hash-0.1.1 | test/spec.go |
google_hash-0.0.0 | test/spec.go |