Sha256: 6b4cf4fd0255071e66388154be1a3c67022b020749599645823fcda14c496698

Contents?: true

Size: 775 Bytes

Versions: 3

Compression:

Stored size: 775 Bytes

Contents

require File.expand_path(File.dirname(__FILE__)) + '/helper'

class TestUVCoords < Test::Unit::TestCase
  include Tracksperanto::UVCoordinates
  
  DELTA = 0.001
  
  def test_from_uv
    assert_in_delta 719.5, convert_from_uv(1.0, 720), DELTA
    assert_in_delta 0.5, convert_from_uv(-1.0, 720), DELTA
  end
  
  def test_from_uv_with_small_values
    assert_in_delta 0.5, convert_from_uv(-1.0, 16), DELTA
    assert_in_delta 15.5, convert_from_uv(1.0, 16), DELTA
  end
  
  def test_to_uv_with_small_values
    assert_in_delta -1.0, convert_to_uv(0.5, 16), DELTA
    assert_in_delta 1.0, convert_to_uv(15.5, 16), DELTA
  end
  
  
  def test_to_uv
    assert_in_delta 1.0, convert_to_uv(719.5, 720), DELTA
    assert_in_delta -1.0, convert_to_uv(0.5, 720), DELTA
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tracksperanto-4.1.2 test/test_uv_coords.rb
tracksperanto-4.1.0 test/test_uv_coords.rb
tracksperanto-4.0.0 test/test_uv_coords.rb