Sha256: 205622e8b2e0362950131375ce7a6df4f45e6ec561a100d652576cef1e8b3ee4

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Restriction::Tautology, '#optimizable?' do
  subject { object.optimizable? }

  let(:base)     { Relation.new([[:id, Integer]], LazyEnumerable.new([[1]])) }
  let(:relation) { base.restrict { predicate }                               }
  let(:object)   { described_class.new(relation)                             }

  before do
    expect(object.operation).to be_kind_of(Algebra::Restriction)
  end

  context 'when the predicate is a tautology' do
    let(:predicate) { Function::Proposition::Tautology.instance }

    it { should be(true) }
  end

  context 'when the predicate is not a tautology' do
    let(:predicate) { Function::Proposition::Contradiction.instance }

    it { should be(false) }
  end

  context 'when the predicate is true' do
    let(:predicate) { true }

    it { should be(true) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/algebra/restriction/tautology/optimizable_predicate_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/algebra/restriction/tautology/optimizable_predicate_spec.rb