Sha256: fcccefaa9215b027cd86dd913eb960be70dad7e2f6feba13e206b8ad1324184c

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  before do
    object.operation.should 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

4 entries across 4 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/algebra/restriction/tautology/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/algebra/restriction/tautology/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/restriction/tautology/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/restriction/tautology/optimizable_spec.rb