From 4db01daeecf955142f1c625f156cd2a9a3ffbd40 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 15 Nov 2007 22:06:01 +0000 Subject: [PATCH] * Add more tests for the ruby binding --- ruby/t/tc_canvas.rb | 29 +++++++++++++++++++++++++++++ ruby/test | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 ruby/t/tc_canvas.rb diff --git a/ruby/t/tc_canvas.rb b/ruby/t/tc_canvas.rb new file mode 100644 index 0000000..ad03ede --- /dev/null +++ b/ruby/t/tc_canvas.rb @@ -0,0 +1,29 @@ +require 'test/unit' +require 'cucul' + +class TC_Canvas < Test::Unit::TestCase + def setup + @c = Cucul::Canvas.new(3, 3) + end + def test_create + c = Cucul::Canvas.new(3, 3) + assert(c, 'Canvas creation failed') + assert(c.width == 3 && c.height == 3, 'Wrong size for new canvas') + end + def test_width + @c.width=42 + assert_equal(c.width, 42, 'Failed to set width') + end + def test_height + @c.height=42 + assert_equal(c.height, 42, 'Failed to set width') + end + def test_size + @c.set_size(100,100) + assert(@c.width == 100 && @c.height == 100, 'Failed to set size') + end + def test_import + @c.import_memory("foo", "") + assert_equal(@c.export_memory("irc"), "foo\r\n", "Import/Export failed") + end +end diff --git a/ruby/test b/ruby/test index bd50a74..58f52b8 100755 --- a/ruby/test +++ b/ruby/test @@ -4,3 +4,5 @@ require 'test/unit' Dir.glob("t/tc*.rb").each{ |t| require t } + +exit Test::Unit::AutoRunner.run