<commit_before>require_relative 'helper'

describe 'DumbConnection' do
  before { Spawn.reseed }
  let(:db) { Tarantool16.new host: 'localhost:16788' }

  it "should select by pk" do
    db.select(:test, 1).must_equal [[1, 'hello', [1,2]]]
    db.select(513, 2).must_equal [[2, 'world', [3,4]]]
  end
end<commit_msg>a bit more tests<commit_after>require_relative 'helper'

describe 'DumbConnection' do
  before { Spawn.reseed }
  let(:db) { Tarantool16.new host: 'localhost:16788' }

  it "should select by pk" do
    db.select(:test, 1).must_equal [[1, 'hello', [1,2]]]
    db.select(513, 2).must_equal [[2, 'world', [3,4]]]
  end

  it "should select by pk" do
    db.select(:test, 1).must_equal [[1, 'hello', [1,2]]]
    db.select(513, 2).must_equal [[2, 'world', [3,4]]]
  end

  it "should select by secondary index" do
    db.select(:test, "hello", index: 1).must_equal [[1, 'hello', [1,2]]]
    db.select(:test, "world", index: 'name').must_equal [[2, 'world', [3,4]]]
    db.select(:test, ["hello"], index: 1).must_equal [[1, 'hello', [1,2]]]
  end

  it "should insert" do
    db.insert(:test, [3, "johny", [5,6]])
    db.select(513, 3).must_equal [[3, "johny", [5,6]]]
  end

  it "should update" do
  end

  describe "with field names" do
    before {
      db.define_fields(:test, [[:id, :int], [:name, :str], [:point, :array]])
    }
    it "should select by hash" do
      db.select(:test, {id: 1}).must_equal [{id:1, name:'hello', point:[1,2]}]
      db.select(:test, {name: "world"}).must_equal [{id:2, name:'world', point:[3,4]}]
    end

  end
end
{'fraction_non_alphanumeric': 0.20830670926517572, 'fraction_numerical': 0.04792332268370607, 'mean_word_length': 3.8633540372670807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2310855', 'n_tokens_mistral': 652, 'n_tokens_neox': 612, 'n_words': 158}