Sha256: 706703f7ef15e8a546b104e2546b7300c9a78d918904e6b0330069ab7e39700d

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

require 'is'

describe Is do

  AREA  = \
    [
      [1, 1],
      [3, 1],
      [3, 3],
      [1, 3]
    ]

  describe '#point' do

    it 'is inside area' do
      point = [2, 2]
      Is.point(point).in?(AREA).should be_true
    end

    it "isn't inside area" do
      point = [0, 2]
      Is.point(point).in?(AREA).should_not be_true
    end

  end

  describe '#all_points' do

    it 'are inside area' do
      points = [[2, 2], [2, 2.5]]
      Is.all_points(points).in?(AREA).should be_true
    end

    it "aren't inside area" do
      points = [[0, 2], [0, 1]]
      Is.all_points(points).in?(AREA).should_not be_true
    end

  end

  describe '#any_points' do

    it 'are inside area' do
      points = [[2, 0], [2, 2.5]]
      Is.any_points(points).in?(AREA).should be_true
    end

    it "aren't inside area" do
      points = [[0, 2], [0, 1]]
      Is.any_points(points).in?(AREA).should_not be_true
    end

  end

  describe '#point_in_area?' do

    it 'is inside area' do
      point = [2, 2]
      Is.point_in_area?(point, AREA).should be_true
    end

    it "isn't inside area" do
      point = [0, 2]
      Is.point_in_area?(point, AREA).should_not be_true
    end

  end

  describe '#all_points_in_area?' do

    it 'are inside area' do
      points = [[2, 2], [2, 2.5]]
      Is.all_points_in_area?(points, AREA).should be_true
    end

    it "aren't inside area" do
      points = [[0, 2], [0, 1]]
      Is.all_points_in_area?(points, AREA).should_not be_true
    end

  end

  describe '#any_points_in_area?' do

    it 'are inside area' do
      points = [[2, 0], [2, 2.5]]
      Is.any_points_in_area?(points, AREA).should be_true
    end

    it "aren't inside area" do
      points = [[0, 2], [0, 1]]
      Is.any_points_in_area?(points, AREA).should_not be_true
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
is-0.0.1 spec/is/basic_spec.rb