Sha256: b8a80d9080ddec29a4b9f2df2d1a700d5709f9d8f8fc3d2a78c5fe9ef1c0077e

Contents?: true

Size: 911 Bytes

Versions: 16

Compression:

Stored size: 911 Bytes

Contents

# frozen_string_literal: true

require_relative 'helper'

class ExtraliteTest < MiniTest::Test
  def test_sqlite3_version
    assert_match /^3\.\d+\.\d+$/, Extralite.sqlite3_version
  end

  def test_status
    db = Extralite::Database.new(':memory:')
    db.query('create table if not exists t (x,y,z)')
    db.query('insert into t values (1, 2, 3)')

    begin
      a = Extralite::runtime_status(Extralite::SQLITE_STATUS_MEMORY_USED, false)
      b = Extralite::runtime_status(Extralite::SQLITE_STATUS_MEMORY_USED)
      c = Extralite::runtime_status(Extralite::SQLITE_STATUS_MEMORY_USED, true)
      d = Extralite::runtime_status(Extralite::SQLITE_STATUS_MEMORY_USED, true)

      assert_operator 0, :<, a[0]
      assert_operator a[0], :<=, a[1]
      
      assert_equal a, b
      assert_equal a, c

      assert_equal a[0], d[0]
      assert_equal a[0], d[1]
    ensure
      db.close
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
extralite-bundle-1.27 test/test_extralite.rb
extralite-1.27 test/test_extralite.rb
extralite-bundle-1.26 test/test_extralite.rb
extralite-1.26 test/test_extralite.rb
extralite-bundle-1.25 test/test_extralite.rb
extralite-1.25 test/test_extralite.rb
extralite-bundle-1.24 test/test_extralite.rb
extralite-1.24 test/test_extralite.rb
extralite-bundle-1.23 test/test_extralite.rb
extralite-1.23 test/test_extralite.rb
extralite-bundle-1.22 test/test_extralite.rb
extralite-1.22 test/test_extralite.rb
extralite-bundle-1.21 test/test_extralite.rb
extralite-1.21 test/test_extralite.rb
extralite-bundle-1.20 test/test_extralite.rb
extralite-1.20 test/test_extralite.rb