1# encoding: utf-8
2require_relative 'spec_helper'
3
4load_extension('st')
5
6describe "st hash table function" do
7  before :each do
8    @s = CApiStSpecs.new
9  end
10
11  describe "st_init_numtable" do
12    it "initializes without error" do
13      @s.st_init_numtable.should == 0
14    end
15  end
16
17  describe "st_init_numtable_with_size" do
18    it "initializes without error" do
19      @s.st_init_numtable_with_size.should == 0
20    end
21  end
22
23  describe "st_insert" do
24    it "returns size 1 after insert" do
25      @s.st_insert.should == 1
26    end
27  end
28
29  describe "st_foreach" do
30    it "iterates over each pair of key and value" do
31      @s.st_foreach.should == 7
32    end
33  end
34
35  describe "st_lookup" do
36    it "returns the expected value" do
37      @s.st_lookup.should == 42
38    end
39  end
40
41end
42