[cairo-commit] rcairo/test-unit/sample adder.rb, NONE, 1.1 subtracter.rb, NONE, 1.1 tc_adder.rb, NONE, 1.1 tc_subtracter.rb, NONE, 1.1 ts_examples.rb, NONE, 1.1

Kouhei Sutou commit at pdx.freedesktop.org
Wed Aug 13 01:20:59 PDT 2008


Committed by: kou

Update of /cvs/cairo/rcairo/test-unit/sample
In directory kemper:/tmp/cvs-serv10309/test-unit/sample

Added Files:
	adder.rb subtracter.rb tc_adder.rb tc_subtracter.rb 
	ts_examples.rb 
Log Message:
* test-unit: imported Test::Unit 2.x.


--- NEW FILE: adder.rb ---
# Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license.

class Adder
  def initialize(number)
    @number = number
  end
  def add(number)
    return @number + number
  end
end


--- NEW FILE: subtracter.rb ---
# Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license.

class Subtracter
  def initialize(number)
    @number = number
  end
  def subtract(number)
    return @number - number
  end
end

--- NEW FILE: tc_adder.rb ---
# Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license.

require 'test/unit'
require 'adder'

class TC_Adder < Test::Unit::TestCase
  def setup
    @adder = Adder.new(5)
  end
  def test_add
    assert_equal(7, @adder.add(2), "Should have added correctly")
  end
  def teardown
    @adder = nil
  end
end

--- NEW FILE: tc_subtracter.rb ---
# Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license.

require 'test/unit'
require 'subtracter'

class TC_Subtracter < Test::Unit::TestCase
  def setup
    @subtracter = Subtracter.new(5)
  end
  def test_subtract
    assert_equal(3, @subtracter.subtract(2), "Should have subtracted correctly")
  end
  def teardown
    @subtracter = nil
  end
end

--- NEW FILE: ts_examples.rb ---
# Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license.

require 'test/unit'
require 'tc_adder'
require 'tc_subtracter'



More information about the cairo-commit mailing list