Sha256: 87394fdbfc7899446716d375865c1fe030ff6950e38216884b5d2d7ad201c1b8

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__),"spec_helper.rb"))
require 'amalgalite/sqlite3'
require 'rbconfig'

describe "Amalgalite::SQLite3" do
  it "is threadsafe is ruby is compiled with pthread support, in this case that is (#{Config::CONFIG['configure_args'].include?( "--enable-pthread" )})" do
    Amalgalite::SQLite3.threadsafe?.should == Config::CONFIG['configure_args'].include?( "--enable-pthread" )
  end

  it "knows if an SQL statement is complete" do
    Amalgalite::SQLite3.complete?("SELECT * FROM sometable;").should == true
    Amalgalite::SQLite3.complete?("SELECT * FROM sometable;", :utf16 => true).should == true
  end
  
  it "knows if an SQL statement is not complete" do
    Amalgalite::SQLite3.complete?("SELECT * FROM sometable ").should == false
    Amalgalite::SQLite3.complete?("SELECT * FROM sometable WHERE ", :utf16 => true).should == false
  end

  it "knows how much memory it has used" do
    Amalgalite::SQLite3.memory_used.should >= 0
  end
  
  it "knows the maximum amount of memory it has used so far" do
    Amalgalite::SQLite3.memory_highwater_mark.should >= 0
  end
  
  it "can reset it maximum memory usage counter" do
    Amalgalite::SQLite3.memory_highwater_mark_reset!.should >= 0
  end

  it "can produce random data" do
    Amalgalite::SQLite3.randomness( 42 ).size.should == 42
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
amalgalite-0.2.1 spec/sqlite3_spec.rb
amalgalite-0.2.3 spec/sqlite3_spec.rb
amalgalite-0.2.2 spec/sqlite3_spec.rb
amalgalite-0.2.4 spec/sqlite3_spec.rb