Sha256: 7620df0ca9b8e34af221210a6c1e81a909d77cc14b66e4d9dbd6c699d7783359

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 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 be(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 be(Function::Proposition::Tautology.instance) }

    it_should_behave_like 'an optimize method'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/integration/axiom/function/connective/negation/optimize_spec.rb
axiom-optimizer-0.1.1 spec/integration/axiom/function/connective/negation/optimize_spec.rb