File: test_sqlite3.rb

package info (click to toggle)
ruby-sqlite3 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 680 kB
  • sloc: ruby: 4,827; ansic: 1,868; sh: 91; makefile: 7
file content (41 lines) | stat: -rw-r--r-- 1,242 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require "helper"

module SQLite3
  class TestSQLite3 < SQLite3::TestCase
    def test_libversion
      assert_not_nil SQLite3.libversion
    end

    def test_threadsafe
      assert_not_nil SQLite3.threadsafe
    end

    def test_threadsafe?
      if SQLite3.threadsafe > 0
        assert_predicate SQLite3, :threadsafe?
      else
        refute_predicate SQLite3, :threadsafe?
      end
    end

    def test_compiled_version_and_loaded_version
      assert_equal(SQLite3::SQLITE_VERSION, SQLite3::SQLITE_LOADED_VERSION)
    end

    def test_status
      status = SQLite3.status(SQLite3::Constants::Status::MEMORY_USED)
      assert_operator(status.fetch(:current), :>=, 0)
      assert_operator(status.fetch(:highwater), :>=, status.fetch(:current))
    end

    def test_status_reset_highwater_mark
      status = SQLite3.status(SQLite3::Constants::Status::MEMORY_USED, false)
      assert_operator(status.fetch(:current), :>=, 0)
      assert_operator(status.fetch(:highwater), :>=, status.fetch(:current))

      status = SQLite3.status(SQLite3::Constants::Status::MEMORY_USED, true)
      assert_operator(status.fetch(:current), :>=, 0)
      assert_operator(status.fetch(:highwater), :>=, status.fetch(:current))
    end
  end
end