diff --git a/ruby/t/tc_canvas.rb b/ruby/t/tc_canvas.rb index 767c50a..ca480ab 100644 --- a/ruby/t/tc_canvas.rb +++ b/ruby/t/tc_canvas.rb @@ -1,12 +1,12 @@ require 'caca' -class TC_Canvas < Test::Unit::TestCase +class TC_Canvas < MiniTest::Test def setup @c = Caca::Canvas.new(3, 3) end def test_create c = Caca::Canvas.new(3, 3) - assert_not_nil(c, 'Canvas creation failed') + refute_nil(c, 'Canvas creation failed') assert(c.width == 3 && c.height == 3, 'Wrong size for new canvas') end def test_width @@ -47,13 +47,13 @@ class TC_Canvas < Test::Unit::TestCase end def test_render c = Caca::Canvas.new(4,4) - c.put_str(0,0,"plop") - f = Caca::Font.new(Caca::Font.list[0]) - assert_not_nil(c.render(f, c.width*f.width, c.height*f.height, c.width*f.width*4)) + c.put_str(0,0,"plop") + f = Caca::Font.new(Caca::Font.list[0]) + refute_nil(c.render(f, c.width*f.width, c.height*f.height, c.width*f.width*4)) end def test_fail_render c = Caca::Canvas.new(4,4) - assert_raise(ArgumentError) { + assert_raises(ArgumentError) { c.render(nil, c.width, c.height, c.width*4) } end diff --git a/ruby/t/tc_display.rb b/ruby/t/tc_display.rb index ff2b64e..7d0010c 100644 --- a/ruby/t/tc_display.rb +++ b/ruby/t/tc_display.rb @@ -1,25 +1,25 @@ require 'caca' -class TC_Canvas < Test::Unit::TestCase +class TC_Canvas < MiniTest::Test def test_create d = Caca::Display.new() - assert_not_nil(d, 'Display creation failed') + refute_nil(d, 'Display creation failed') end def test_create_with_driver d = Caca::Display.new(Caca::Display.driver_list[0]) - assert_not_nil(d, 'Display creation failed') + refute_nil(d, 'Display creation failed') end def test_create_wrong_args c = Caca::Canvas.new(3, 3) - assert_raise(RuntimeError){Caca::Display.new("plop")} - assert_raise(RuntimeError){Caca::Display.new(c, "plop")} - assert_raise(ArgumentError){Caca::Display.new("plop", "plop")} - assert_raise(ArgumentError){Caca::Display.new(c, c)} + assert_raises(RuntimeError){Caca::Display.new("plop")} + assert_raises(RuntimeError){Caca::Display.new(c, "plop")} + assert_raises(ArgumentError){Caca::Display.new("plop", "plop")} + assert_raises(ArgumentError){Caca::Display.new(c, c)} end def test_create_from_canvas c = Caca::Canvas.new(3, 3) d = Caca::Display.new(c) - assert_not_nil(d, 'Display creation failed') + refute_nil(d, 'Display creation failed') assert_equal(d.canvas, c, 'Wrong canvas') end def test_set_title diff --git a/ruby/t/tc_dither.rb b/ruby/t/tc_dither.rb index ac3f42c..bdb2956 100644 --- a/ruby/t/tc_dither.rb +++ b/ruby/t/tc_dither.rb @@ -1,50 +1,41 @@ require 'caca' -class TC_Canvas < Test::Unit::TestCase +class TC_Canvas < MiniTest::Test def test_create - assert_nothing_raised { - d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) - } + d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) end def test_fail_create - assert_raise(RuntimeError) { + assert_raises(RuntimeError) { d = Caca::Dither.new(-1, 32, 32, 32, 0, 0, 0, 0) - } + } end def test_set_palette - assert_nothing_raised { - d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) - d.palette=[[0xfff, 0xfff, 0xfff, 0xfff]]*256 - } + d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) + d.palette = [[0xfff, 0xfff, 0xfff, 0xfff]] * 256 end def test_fail_set_palette - assert_raise(ArgumentError) { + assert_raises(ArgumentError) { d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) - d.palette=[] - } + d.palette = [] + } end def test_fail_set_palette2 - assert_raise(RuntimeError) { + assert_raises(RuntimeError) { d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) - d.palette=[[0xffff, 0, 0, 0]]*256 - } + d.palette = [[0xffff, 0, 0, 0]] * 256 + } end def test_set_brightness - assert_nothing_raised { - d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) - d.brightness=0.5 - } + d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) + d.brightness = 0.5 end def test_set_gamma - assert_nothing_raised { - d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) - d.gamma=0.5 - } + d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) + d.gamma = 0.5 end def test_set_contrast - assert_nothing_raised { - d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) - d.contrast=0.5 - } + d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) + d.contrast = 0.5 end end + diff --git a/ruby/t/tc_font.rb b/ruby/t/tc_font.rb index 7947e67..22915c9 100644 --- a/ruby/t/tc_font.rb +++ b/ruby/t/tc_font.rb @@ -1,21 +1,21 @@ require 'caca' -class TC_Canvas < Test::Unit::TestCase +class TC_Canvas < MiniTest::Test def test_list - assert_not_nil(Caca::Font.list) + refute_nil(Caca::Font.list) end def test_load - Caca::Font.list.each{|f| - font = Caca::Font.new(f) - assert_not_nil(font) - assert_not_nil(font.width) - assert_not_nil(font.height) - assert_not_nil(font.blocks) - } + Caca::Font.list.each{|f| + font = Caca::Font.new(f) + refute_nil(font) + refute_nil(font.width) + refute_nil(font.height) + refute_nil(font.blocks) + } end def test_fail_load - assert_raise(RuntimeError) { - Caca::Font.new("This font should not exist") - } + assert_raises(RuntimeError) { + Caca::Font.new("This font should not exist") + } end end diff --git a/ruby/t/tc_frame.rb b/ruby/t/tc_frame.rb index 437ec04..4887aed 100644 --- a/ruby/t/tc_frame.rb +++ b/ruby/t/tc_frame.rb @@ -1,19 +1,19 @@ require 'caca' -class TC_Frame < Test::Unit::TestCase - def setup - @c = Caca::Canvas.new(3, 3) - end - def test_create - f = @c.create_frame(1) - assert(f, 'Frame creation failed') - @c.free_frame(1) - end - def test_name - f = @c.create_frame(1) - assert(@c.frame_name, 'Failed to get frame name') - @c.frame_name="test" - assert(@c.frame_name == "test", 'Failed to set frame name') - @c.free_frame(1) - end +class TC_Frame < MiniTest::Test + def setup + @c = Caca::Canvas.new(3, 3) + end + def test_create + f = @c.create_frame(1) + assert(f, 'Frame creation failed') + @c.free_frame(1) + end + def test_name + f = @c.create_frame(1) + assert(@c.frame_name, 'Failed to get frame name') + @c.frame_name="test" + assert(@c.frame_name == "test", 'Failed to set frame name') + @c.free_frame(1) + end end diff --git a/ruby/test b/ruby/test index 1c0585b..66ee708 100755 --- a/ruby/test +++ b/ruby/test @@ -1,11 +1,10 @@ #!/usr/bin/ruby -require 'test/unit' +require 'minitest/autorun' $LOAD_PATH.unshift(".libs").unshift("lib") -Dir.glob("t/tc*.rb").each{ |t| +Dir.glob("./t/tc*.rb").each{ |t| require t } -exit Test::Unit::AutoRunner.run