Sha256: 5063588aeb47f0770566d1173e31ebebed82171b9a0f9585efeea4821f50606c

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Function::Connective::Negation, '#optimize' do
  subject { object.optimize }

  let(:attribute) { Attribute::Integer.new(:id)  }
  let(:object)    { described_class.new(operand) }

  context 'operand is a predicate' do
    let(:operand) { attribute.gt(1) }

    it { should eql(attribute.lte(1)) }

    it_should_behave_like 'an optimize method'
  end

  context 'operand is a objected predicate' do
    let(:predicate) { attribute.gt(1)                }
    let(:operand)   { described_class.new(predicate) }

    it { should eql(predicate) }

    it_should_behave_like 'an optimize method'
  end

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

    it { should equal(Function::Proposition::Contradiction.instance) }

    it_should_behave_like 'an optimize method'
  end

  context 'operand is a contradiction' do
    let(:operand) { Function::Proposition::Contradiction.instance }

    it { should equal(Function::Proposition::Tautology.instance) }

    it_should_behave_like 'an optimize method'
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
axiom-optimizer-0.1.0 spec/integration/axiom/function/connective/negation/optimize_spec.rb
veritas-optimizer-0.0.7 spec/integration/veritas/function/connective/negation/optimize_spec.rb
veritas-optimizer-0.0.6 spec/integration/veritas/function/connective/negation/optimize_spec.rb
veritas-optimizer-0.0.5 spec/integration/veritas/function/connective/negation/optimize_spec.rb
veritas-optimizer-0.0.4 spec/integration/veritas/function/connective/negation/optimize_spec.rb