Sha256: 4699dc170693ea7a708e138564bdc065f11b2d2fbbe48bd27db5c1d5d1930518
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Algebra::Restriction::Contradiction, '#optimizable?' do subject { object.optimizable? } let(:header) { Relation::Header.new([ [ :id, Integer ] ]) } let(:base) { Relation.new(header, [ [ 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 contradiction' do let(:predicate) { Function::Proposition::Contradiction.instance } it { should be(true) } end context 'when the predicate is not a contradiction' do let(:predicate) { Function::Proposition::Tautology.instance } it { should be(false) } end context 'when the predicate is false' do let(:predicate) { false } it { should be(true) } end context 'when the predicate is true' do let(:predicate) { true } it { should be(false) } end context 'when the predicate is a Proc' do let(:predicate) { proc { false } } it { should be(false) } end end
Version data entries
4 entries across 4 versions & 1 rubygems