Sha256: a14b417ee71d5ff921562ea1a8ac6b3aede6259b42aaedf6715f46e92b269754

Contents?: true

Size: 812 Bytes

Versions: 7

Compression:

Stored size: 812 Bytes

Contents

require File.expand_path(File.dirname(__FILE__)) + '/spec_helper.rb'

describe MPFR::Matrix, "when MPFR instance is converted to string by some methods." do
  
  before(:all) do
    MPFR.set_default_prec(128)
    @row = 2
    @column = 3
    @matrixes = ((0..100).map { |i| MPFR::Matrix.new(GenerateNumber.float_arguments(@column, @row)) })
  end

  it "should return array having strings." do
    @matrixes.each do |m|
      m.str_ary("%.Re").each_with_index do |s, i|
        s.to_s.should eql m[i % @row, i / @row].to_s
      end
    end
  end

  it "should return inspect string." do
    @matrixes.each do |m|
      ins = m.inspect
      ins.should match(/#{Regexp.escape(sprintf("%x", m.object_id))}/)
      m.each do |a|
        ins.should match(/#{Regexp.escape(a.to_s)}/)
      end
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby-mpfr-0.0.14 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.13 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.12 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.11 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.10 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.9 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.8 spec/mpfr_matrix/mpfr_matrix_string_spec.rb