ruby-changes:10209
From: shyouhei <ko1@a...>
Date: Sun, 25 Jan 2009 00:02:00 +0900 (JST)
Subject: [ruby-changes:10209] Ruby:r21753 (ruby_1_8_6): merge revision(s) 19339:
shyouhei 2009-01-25 00:01:50 +0900 (Sun, 25 Jan 2009) New Revision: 21753 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21753 Log: merge revision(s) 19339: * lib/matrix.rb (Vector#eql?): typo of the method name as "eqn?". (Vector#eqn?): removed. Defined by mistake. Fixes [ruby-dev:36294]. Reported by weda <weda AT issp.u-tokyo.ac.jp> and an anonymous user. * test/matrix/test_matrix.rb: added. * test/matrix/test_vector.rb: added. Added directories: branches/ruby_1_8_6/test/matrix/ Modified files: branches/ruby_1_8_6/ChangeLog branches/ruby_1_8_6/lib/matrix.rb branches/ruby_1_8_6/version.h Index: ruby_1_8_6/ChangeLog =================================================================== --- ruby_1_8_6/ChangeLog (revision 21752) +++ ruby_1_8_6/ChangeLog (revision 21753) @@ -1,3 +1,14 @@ +Sun Jan 25 00:00:50 2009 Yuki Sonoda (Yugui) <yugui@y...> + + * lib/matrix.rb (Vector#eql?): typo of the method name as "eqn?". + (Vector#eqn?): removed. Defined by mistake. + Fixes [ruby-dev:36294]. Reported by weda <weda AT + issp.u-tokyo.ac.jp> and an anonymous user. + + * test/matrix/test_matrix.rb: added. + + * test/matrix/test_vector.rb: added. + Fri Jan 23 11:42:21 2009 Shugo Maeda <shugo@r...> * NEWS: added an entry for REXML. Index: ruby_1_8_6/version.h =================================================================== --- ruby_1_8_6/version.h (revision 21752) +++ ruby_1_8_6/version.h (revision 21753) @@ -1,15 +1,15 @@ #define RUBY_VERSION "1.8.6" -#define RUBY_RELEASE_DATE "2009-01-23" +#define RUBY_RELEASE_DATE "2009-01-25" #define RUBY_VERSION_CODE 186 -#define RUBY_RELEASE_CODE 20090123 -#define RUBY_PATCHLEVEL 307 +#define RUBY_RELEASE_CODE 20090125 +#define RUBY_PATCHLEVEL 308 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 #define RUBY_VERSION_TEENY 6 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 23 +#define RUBY_RELEASE_DAY 25 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: ruby_1_8_6/lib/matrix.rb =================================================================== --- ruby_1_8_6/lib/matrix.rb (revision 21752) +++ ruby_1_8_6/lib/matrix.rb (revision 21753) @@ -1081,7 +1081,7 @@ other.compare_by(@elements) end - alias eqn? == + alias eql? == # # For internal use. Index: ruby_1_8_6/test/matrix/test_vector.rb =================================================================== --- ruby_1_8_6/test/matrix/test_vector.rb (revision 0) +++ ruby_1_8_6/test/matrix/test_vector.rb (revision 21753) @@ -0,0 +1,43 @@ +require 'test/unit' +require 'matrix' + +class TestVector < Test::Unit::TestCase + def setup + @v1 = Vector[1,2,3] + @v2 = Vector[1,2,3] + @v3 = @v1.clone + @v4 = Vector[1,0, 2.0, 3.0] + @w1 = Vector[2,3,4] + end + + def test_identity + assert_same @v1, @v1 + assert_not_same @v1, @v2 + assert_not_same @v1, @v3 + assert_not_same @v1, @v4 + assert_not_same @v1, @w1 + end + + def test_equality + assert_equal @v1, @v1 + assert_equal @v1, @v2 + assert_equal @v1, @v3 + assert_not_equal @v1, @v4 + assert_not_equal @v1, @w1 + end + + def test_hash_equality + assert @v1.eql?(@v1) + assert @v1.eql?(@v2) + assert @v1.eql?(@v3) + assert !@v1.eql?(@v4) + assert !@v1.eql?(@w1) + + hash = { @v1 => :value } + assert hash.key?(@v1) + assert hash.key?(@v2) + assert hash.key?(@v3) + assert !hash.key?(@v4) + assert !hash.key?(@w1) + end +end Index: ruby_1_8_6/test/matrix/test_matrix.rb =================================================================== --- ruby_1_8_6/test/matrix/test_matrix.rb (revision 0) +++ ruby_1_8_6/test/matrix/test_matrix.rb (revision 21753) @@ -0,0 +1,43 @@ +require 'test/unit' +require 'matrix' + +class TestMatrix < Test::Unit::TestCase + def setup + @m1 = Matrix[[1,2,3], [4,5,6]] + @m2 = Matrix[[1,2,3], [4,5,6]] + @m3 = @m1.clone + @m4 = Matrix[[1,0, 2.0, 3.0], [4.0, 5.0, 6.0]] + @n1 = Matrix[[2,3,4], [5,6,7]] + end + + def test_identity + assert_same @m1, @m1 + assert_not_same @m1, @m2 + assert_not_same @m1, @m3 + assert_not_same @m1, @m4 + assert_not_same @m1, @n1 + end + + def test_equality + assert_equal @m1, @m1 + assert_equal @m1, @m2 + assert_equal @m1, @m3 + assert_not_equal @m1, @m4 + assert_not_equal @m1, @n1 + end + + def test_hash_equality + assert @m1.eql?(@m1) + assert @m1.eql?(@m2) + assert @m1.eql?(@m3) + assert !@m1.eql?(@m4) + assert !@m1.eql?(@n1) + + hash = { @m1 => :value } + assert hash.key?(@m1) + assert hash.key?(@m2) + assert hash.key?(@m3) + assert !hash.key?(@m4) + assert !hash.key?(@n1) + end +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/