Sha256: 1d881f91a7d1832803e5aa9a6c409fe3c2947858f2975d19fcc8d312c3288b28

Contents?: true

Size: 1.76 KB

Versions: 45

Compression:

Stored size: 1.76 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__),%w[ .. spec_helper.rb ]))

require 'amalgalite/sqlite3/constants'

describe Amalgalite::SQLite3::Constants do

  it "has Open constants" do
    Amalgalite::SQLite3::Constants::Open::READONLY.should > 0
  end
  
  it "has DataType constants" do
    Amalgalite::SQLite3::Constants::DataType::BLOB.should > 0
  end

  it "has ResultCode constants" do
  end

  describe 'ResultCode' do 
    it "has constants" do
      Amalgalite::SQLite3::Constants::ResultCode::OK.should == 0
    end

    it "can return the constant from a number" do
      c = Amalgalite::SQLite3::Constants::ResultCode.name_from_value( 21 )
      c.should == "MISUSE"
    end

    it "can return the number from a name" do
      v = Amalgalite::SQLite3::Constants::ResultCode.value_from_name( "MISUSE" )
      v.should == 21
    end
  end

  describe 'Status' do
    it "has constants" do
      Amalgalite::SQLite3::Constants::Status::MEMORY_USED.should == 0
    end

    it "can return the constant from a number" do
      c = Amalgalite::SQLite3::Constants::Status.name_from_value( 3 )
      c.should == "SCRATCH_USED"
    end
    
    it "can return the number from a name" do
      v = Amalgalite::SQLite3::Constants::Status.value_from_name( "memory_used" )
      v.should == 0
    end
  end

  describe 'DBStatus' do
    it "has constants" do
      Amalgalite::SQLite3::Constants::DBStatus::LOOKASIDE_USED.should == 0
    end

    it "can return the constant from a number" do
      c = Amalgalite::SQLite3::Constants::DBStatus.name_from_value( 0 )
      c.should == "LOOKASIDE_USED"
    end
    
    it "can return the number from a name" do
      v = Amalgalite::SQLite3::Constants::DBStatus.value_from_name( "lookaside_used" )
      v.should == 0
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
amalgalite-0.15.0-x86-mingw32 spec/sqlite3/constants_spec.rb
amalgalite-0.15.0-x86-mswin32 spec/sqlite3/constants_spec.rb
amalgalite-0.15.0 spec/sqlite3/constants_spec.rb
amalgalite-0.12.0-x86-mingw32 spec/sqlite3/constants_spec.rb
amalgalite-0.12.0 spec/sqlite3/constants_spec.rb
amalgalite-0.12.0-x86-mswin32 spec/sqlite3/constants_spec.rb
amalgalite-0.11.0-x86-mswin32 spec/sqlite3/constants_spec.rb
amalgalite-0.11.0-x86-mingw32 spec/sqlite3/constants_spec.rb
amalgalite-0.10.2-x86-mswin32 spec/sqlite3/constants_spec.rb
amalgalite-0.10.2-x86-mingw32 spec/sqlite3/constants_spec.rb
amalgalite-0.10.1-x86-mswin32 spec/sqlite3/constants_spec.rb
amalgalite-0.10.1-x86-mingw32 spec/sqlite3/constants_spec.rb
amalgalite-0.10.0-x86-mswin32-60 spec/sqlite3/constants_spec.rb
amalgalite-0.11.0 spec/sqlite3/constants_spec.rb
amalgalite-0.10.2 spec/sqlite3/constants_spec.rb
amalgalite-0.10.0 spec/sqlite3/constants_spec.rb
amalgalite-0.10.1 spec/sqlite3/constants_spec.rb
amalgalite-0.4.0 spec/sqlite3/constants_spec.rb
amalgalite-0.5.0-x86-mswin32-60 spec/sqlite3/constants_spec.rb
amalgalite-0.4.1 spec/sqlite3/constants_spec.rb