Sha256: aefcdb7011004a28984d9598b505d577d03d2cddcab3f5d9d78dff30dd3b5329
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# coding: utf-8 #==============================================================================# # $Id: test_rand.rb 120 2009-02-09 08:22:25Z yuyakato $ #==============================================================================# require File.dirname(__FILE__) + "/test_helper.rb" require File.dirname(__FILE__) + "/../lib/kagemusha/rand" #==============================================================================# class TestKagemushaRand < Test::Unit::TestCase def setup end def test_always musha = Kagemusha::Rand.always(1) assert_equal(Kernel, musha.instance_eval { @klass }) assert_equal([0, 1, 2], (1..100).map { rand(3) }.sort.uniq) musha.swap { assert_equal(1, rand) assert_equal(1, rand(2)) assert_equal(1, rand(3)) assert_equal(1, rand(4)) assert_equal(1, rand(5)) } assert_equal([0, 1, 2], (1..100).map { rand(3) }.sort.uniq) end def test_always_with_block ret = Kagemusha::Rand.always(1) { assert_equal(1, rand) assert_equal(1, rand(2)) assert_equal(1, rand(3)) assert_equal(1, rand(4)) assert_equal(1, rand(5)) 1 } assert_equal(1, ret) end end #==============================================================================# #==============================================================================#
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kagemusha-0.0.8 | test/test_rand.rb |