summaryrefslogtreecommitdiff
path: root/spec/ruby/library/matrix/vector/cross_product_spec.rb
blob: c2698ade4c75540b8faf1f2d82d30042ae17077a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require_relative '../../../spec_helper'
require 'matrix'

describe "Vector#cross_product" do
  it "returns the cross product of a vector" do
    Vector[1, 2, 3].cross_product(Vector[0, -4, 5]).should == Vector[22, -5, -4]
  end

  it "raises an error unless both vectors have dimension 3" do
    -> {
      Vector[1, 2, 3].cross_product(Vector[0, -4])
    }.should raise_error(Vector::ErrDimensionMismatch)
  end
end