Sha256: 443dcbccb5f71caabaa421517caf858f661ecabfba256b7b43f61c2ea8ed4960

Contents?: true

Size: 726 Bytes

Versions: 13

Compression:

Stored size: 726 Bytes

Contents

require 'test_helper'

class ConstTest < GSL::TestCase

  def test_speed_of_light
    c   = GSL::CONST::MKSA::SPEED_OF_LIGHT
    eps = GSL::CONST::MKSA::VACUUM_PERMITTIVITY
    mu  = GSL::CONST::MKSA::VACUUM_PERMEABILITY

    assert_rel c, 1.0 / GSL.sqrt(eps * mu), 1e-6, 'speed of light (mks)'
  end

  def test_light_year
    ly = GSL::CONST::CGSM::LIGHT_YEAR
    c  = GSL::CONST::CGSM::SPEED_OF_LIGHT
    y  = 365.2425 * GSL::CONST::CGSM::DAY

    assert_rel ly, c * y, 1e-6, 'light year (cgs)'
  end

  def test_kilo
    micro = GSL::CONST::NUM::MICRO
    mega  = GSL::CONST::NUM::MEGA
    kilo  = GSL::CONST::NUM::KILO

    assert_rel mega / kilo, 1 / (micro * kilo), 1e-10, 'kilo (mega/kilo, 1/(micro*kilo))'
  end

end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
gsl-2.1.0.3 test/gsl/const_test.rb
gsl-2.1.0.2 test/gsl/const_test.rb
gsl-2.1.0.1 test/gsl/const_test.rb
gsl-2.1.0 test/gsl/const_test.rb
gsl-1.16.0.6 test/gsl/const_test.rb
rb-gsl-1.16.0.5 test/gsl/const_test.rb
rb-gsl-1.16.0.4 test/gsl/const_test.rb
rb-gsl-1.16.0.3 test/gsl/const_test.rb
rb-gsl-1.16.0.3.rc1 test/gsl/const_test.rb
rb-gsl-1.16.0.2 test/gsl/const_test.rb
rb-gsl-1.16.0.1 test/gsl/const_test.rb
rb-gsl-1.16.0 test/gsl/const_test.rb
rb-gsl-1.15.3.2 test/gsl/const_test.rb