Sha256: 779232385b5b9d311f1e0179986de44bae4a7e9641af7dd82d7e4d735f370175

Contents?: true

Size: 686 Bytes

Versions: 5

Compression:

Stored size: 686 Bytes

Contents

require "test_helper"

describe "mask" do
  let(:order) { Order.new }

  def setup
    reset_order
    Order.add_to_booleans a: 1, c: 3, b: 7
  end

  it "mask empty" do
    assert_equal 0x00, order.booleans_mask
    assert_equal 0x00, Order.booleans_mask
  end

  it "mask of one boolean" do
    assert_equal 0x80, order.booleans_mask(:b)
    assert_equal 0x80, Order.booleans_mask(:b)
  end

  it "mask of several booleans" do
    assert_equal 0x8a, order.booleans_mask(:a, :b, :c)
    assert_equal 0x8a, Order.booleans_mask(:a, :b, :c)
  end

  it "order is not relevant" do
    mask = order.booleans_mask(:a, :b, :c)
    assert_equal mask, Order.booleans_mask(:c, :b, :a)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
act_with_booleans-0.0.5 test/mask_test.rb
act_with_booleans-0.0.4 test/mask_test.rb
act_with_booleans-0.0.3 test/mask_test.rb
act_with_booleans-0.0.2 test/mask_test.rb
act_with_booleans-0.0.1 test/mask_test.rb