blob: f26cf585da4008adec2c1968e71e987217745f59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
require File.expand_path('../../../../spec_helper', __FILE__)
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
lambda {
Vector[1, 2, 3].cross_product(Vector[0, -4])
}.should raise_error(Vector::ErrDimensionMismatch)
end
end
|