require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'pp'

describe "TernaryLogic" do
  it "should provide 3-valued-logic for the OR operator" do
    (UNKNOWN | false).should == UNKNOWN
    (UNKNOWN | true).should == true
    (true | UNKNOWN).should == true
    (false | UNKNOWN).should == UNKNOWN
    (UNKNOWN | UNKNOWN).should == UNKNOWN
  end

  it "should provide 3-valued-logic for the AND operator" do
    (UNKNOWN & false).should == false
    (UNKNOWN & true).should == UNKNOWN
    (true & UNKNOWN).should == UNKNOWN
    (false & UNKNOWN).should == false
    (UNKNOWN & UNKNOWN).should == UNKNOWN
  end

  it "shoudn't break the existing | or & methods" do
    (true & true).should == true
    (true & false).should == false
    (false & true).should == false
    (false & false).should == false
    
    (true | true).should == true
    (true | false).should == true
    (false | true).should == true
    (false | false).should == false
  end

end
