spec/02_slice_spec.rb in nmatrix-0.0.9 vs spec/02_slice_spec.rb in nmatrix-0.1.0.rc1

- old
+ new

@@ -6,12 +6,12 @@ # NMatrix was originally inspired by and derived from NArray, by # Masahiro Tanaka: http://narray.rubyforge.org # # == Copyright Information # -# SciRuby is Copyright (c) 2010 - 2012, Ruby Science Foundation -# NMatrix is Copyright (c) 2012, Ruby Science Foundation +# SciRuby is Copyright (c) 2010 - 2014, Ruby Science Foundation +# NMatrix is Copyright (c) 2012 - 2014, John Woods and the Ruby Science Foundation # # Please see LICENSE.txt for additional copyright notices. # # == Contributing # @@ -32,14 +32,18 @@ include RSpec::Longrun::DSL [:dense, :list, :yale].each do |stype| context "for #{stype}" do before :each do - GC.start # don't have to do this, but it helps to make sure we've cleaned up our pointers properly. + #GC.start # don't have to do this, but it helps to make sure we've cleaned up our pointers properly. @m = create_matrix(stype) end + #after :each do + # GC.start + #end + it "should correctly return a row of a reference-slice" do @n = create_rectangular_matrix(stype) @m = @n[1..4,1..3] @m.row(1, :copy).should == @m.row(1, :reference) @m.row(1, :copy).to_flat_array.should == [12,13,0] @@ -252,9 +256,13 @@ nm_eql(n[1,0..1], NVector.new(2, [7,8], dtype: :int32).transpose).should be_true end it 'should be correct slice for range 0..2 and 0...3' do @m[0..2,0..2].should == @m[0...3,0...3] + end + + it 'should correctly handle :* slice notation' do + @m[:*,0].should eq @m[0...@m.shape[0], 0] end if stype == :dense [:byte,:int8,:int16,:int32,:int64,:float32,:float64,:rational64,:rational128].each do |left_dtype| [:byte,:int8,:int16,:int32,:int64,:float32,:float64,:rational64,:rational128].each do |right_dtype|