Sha256: b6fe86f020615fea9859fe72d76ff36a422c91c522075e915a0ad01fc5cf7392

Contents?: true

Size: 897 Bytes

Versions: 9

Compression:

Stored size: 897 Bytes

Contents

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

describe "Amalgalite::SQLite3::Database::Status" do
  before(:each) do
    @db = Amalgalite::Database.new( "lookaside-test.db" )
    @db.execute(" create table t(a, b)")
    20.times do |x|
      @db.execute("insert into t(a, b) values (?,?);", x, x+1)
    end
  end

  after(:each) do
    @db.close
    ::FileUtils.rm_f "lookaside-test.db" 
  end


  it "knows how much lookaside memory it has used" do
    @db.api.status.lookaside_used.highwater.should > 0
    @db.api.status.lookaside_used.current.should >= 0
  end

  it "can reset the highwater value" do
    stat = @db.api.status.lookaside_used
    before = stat.highwater
    before.should > 0

    stat.reset!
    after = stat.highwater

    after.should eql(0)
    after.should_not eql(before)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
amalgalite-1.1.2-x86-mingw32 spec/sqlite3/database_status_spec.rb
amalgalite-1.1.2-x86-mswin32 spec/sqlite3/database_status_spec.rb
amalgalite-1.1.2 spec/sqlite3/database_status_spec.rb
amalgalite-1.1.1-x86-mingw32 spec/sqlite3/database_status_spec.rb
amalgalite-1.1.1-x86-mswin32 spec/sqlite3/database_status_spec.rb
amalgalite-1.1.1 spec/sqlite3/database_status_spec.rb
amalgalite-1.0.0 spec/sqlite3/database_status_spec.rb
amalgalite-1.0.0-x86-mswin32 spec/sqlite3/database_status_spec.rb
amalgalite-1.0.0-x86-mingw32 spec/sqlite3/database_status_spec.rb