Sha256: 054afe4594b4671e453959637e0e27c353a771d8642daaa5641ebd274306064f
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
require 'rspec' require 'rspec/its' require 'matrix' require 'awesome_print' require 'distribution' require 'tempfile' require 'pry-byebug' require 'nokogiri' require 'gruff' def mri? RUBY_ENGINE == 'ruby' end def jruby? RUBY_ENGINE == 'jruby' end if jruby? require 'mdarray' else require 'nmatrix/nmatrix' end RSpec::Expectations.configuration.warn_about_potential_false_positives = false require 'simplecov' SimpleCov.start do add_filter 'spec' minimum_coverage_by_file 95 end $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'daru' ALL_DTYPES = [:nmatrix, :gsl, :array] # FIXME: This must go! Need to be able to use be_within def expect_correct_vector_in_delta v1, v2, delta expect(v1.size).to eq(v2.size) (0...v1.size).each do |v| expect(v1[v]).to be_within(delta).of(v2[v]) end end def expect_correct_df_in_delta df1, df2, delta df1.each_vector_with_index do |vector, i| expect_correct_vector_in_delta vector, df2[i], delta end end class String # allows to pretty test agains multiline strings: # %Q{ # |test # |me # }.unindent # => # "test # me" def unindent gsub(/\n\s+?\|/, "\n") # for all lines looking like "<spaces>|" -- remove this. .gsub(/\|\n/, "\n") # allow to write trailing space not removed by editor .gsub(/^\n|\n\s+$/, '') # remove empty strings before and after end end Dir[File.expand_path('../support/**/*.rb', __FILE__)].each {|f| require f }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
daru-0.1.4.1 | spec/spec_helper.rb |
daru-0.1.4 | spec/spec_helper.rb |