aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/matrix/vector/cross_product_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/matrix/vector/cross_product_spec.rb')
-rw-r--r--spec/ruby/library/matrix/vector/cross_product_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/library/matrix/vector/cross_product_spec.rb b/spec/ruby/library/matrix/vector/cross_product_spec.rb
new file mode 100644
index 0000000000..f26cf585da
--- /dev/null
+++ b/spec/ruby/library/matrix/vector/cross_product_spec.rb
@@ -0,0 +1,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