Fix minishogi notation, enabling play against gnuminishogi.
[kaya/ydirson.git] / test / test_utils.rb
blob7d8d549dc555e043060ecf6f88038e675e1eee29
1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 require 'test/unit'
9 require 'rubygems'
10 require 'mocha'
11 require 'qtutils'
13 class TestQtUtils < Test::Unit::TestCase
14   def test_painter_bracket
15     p = Qt::Painter.new
16     p.expects(:fill_rect).once
17     p.expects(:end).once
18     
19     p.paint do |painter|
20       painter.fill_rect
21     end
22   end
23   
24   def test_detect_index
25     alphabet = ('a'..'z')
26     h = alphabet.detect_index {|l| "hello"[0, 1] == l }
27     
28     assert_equal 7, h
29     
30     result = alphabet.detect_index {|l| 0 == 1 }
31     assert_nil result
32   end
33 end