Sha256: f5a85788ca54fd37aeccd8e7db5638a92b91292db74c6e9614bbe492568e988a

Contents?: true

Size: 934 Bytes

Versions: 4

Compression:

Stored size: 934 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8

require "test/unit"
require "stringio"
require "vasputils/calcrepeater.rb"

#	assert_equal( cor, data)
#	assert_in_delta( cor, data, $tolerance )
#	assert_raise( RuntimeError ){}

class DummyCalc
	attr_reader :num

	def initialize
		@num = 0
		@internal_steps = 0
		@lock = false
	end

	def calculatable?
		return (! @lock)
	end

	def calculate
		@lock = true
		# calculate
		10.times { @internal_steps += 1 }
	end

	def normal_ended?
		return @internal_steps == 10
	end

	def to_be_continued?
		return @num < 3
	end

	def next
		@num += 1
		@lock = false
		@internal_steps = 0
	end

	def teardown
		# do nothing
	end

	def name
		"calc00"
	end
end

class TC_CalcRepeater < Test::Unit::TestCase
	def setup
		@cr00 = CalcRepeater.new
		@dc00 = DummyCalc.new
	end

	def test_repeat
		io = StringIO.new
		assert_equal(0, @dc00.num)
		@cr00.repeat(@dc00, io)
		assert_equal(3, @dc00.num)
	end


end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vasputils-0.0.3 test/test_calcrepeater.rb
vasputils-0.0.2 test/test_calcrepeater.rb
vasputils-0.0.1 test/test_calcrepeater.rb
vasputils-0.0.0 test/test_calcrepeater.rb