Sha256: 86f14a3a7e9a1ac2f953d98ccf70c59bbe008cffeb9e15ff7e6c5addc0aeb7b3

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 Bytes

Contents

require 'spec_helper'

describe DpllSolver::Formulas::Literal do
  let(:var1) { DpllSolver::Formulas::Variable.new("x1") }
  let(:var2) { DpllSolver::Formulas::Variable.new("x2") }
  let(:lit1) { DpllSolver::Formulas::Literal.new(var1, true) }
  let(:lit1_neg) { DpllSolver::Formulas::Literal.new(var1, false) }
  let(:lit2) { DpllSolver::Formulas::Literal.new(var2, true) }

  it 'should negate the literal' do
    expect(lit1.negate()).to eql lit1_neg
    expect(lit1_neg.negate()).to eql lit1
  end

  it 'should convert literal to string' do
    expect(lit2.to_s).to eql "x2"
    expect(lit1.to_s).to eql "x1"
    expect(lit1_neg.to_s).to eql "-x1"
  end

  it 'should compare two literals' do
    expect(lit1 == lit1).to eql true
    expect(lit1 == lit2).to eql false
    expect(lit1 == lit1_neg).to eql false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dpll_solver-0.0.1 spec/formulas/literal_spec.rb