Sha256: 3477a54138fb822469b7da30b6f45ad4bacaef78533da3871aa3c7475782863b

Contents?: true

Size: 635 Bytes

Versions: 6

Compression:

Stored size: 635 Bytes

Contents

# -*- coding: utf-8 -*-


require_relative '../helper'


class TestProcessingUtility < Test::Unit::TestCase

  def context()
    RubySketch::Processing::Context.new RubySketch::Window.new
  end

  def test_random()
    c = context

    assert_equal Float,  c.random(1).class
    assert_equal Float,  c.random(1.0).class
    assert_equal Symbol, c.random((:a..:z).to_a).class

    assert_not_equal c.random, c.random

    10000.times do
      n = c.random
      assert 0 <= n && n < 1

      n = c.random 1
      assert 0 <= n && n < 1

      n = c.random 1, 2
      assert 1.0 <= n && n < 2.0
    end
  end

end# TestProcessingUtility

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubysketch-0.3.21 test/processing/test_utility.rb
rubysketch-0.3.20 test/processing/test_utility.rb
rubysketch-0.3.19 test/processing/test_utility.rb
rubysketch-0.3.18 test/processing/test_utility.rb
rubysketch-0.3.17 test/processing/test_utility.rb
rubysketch-0.3.16 test/processing/test_utility.rb