Updated CHANGES.current.
Fixed problems with insert() and unshift() functions in std::vector for ruby. Updated Ruby documentation. Improved swig_assert.rb. Added "second" singleton to std_pair in ruby. Modified two tests to follow the new STL stuff. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9721 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b2a45de097
commit
806d9040c5
11 changed files with 2768 additions and 1075 deletions
|
|
@ -40,29 +40,28 @@ end
|
|||
"@iv[1..-2].to_s" => '12',
|
||||
"@iv[2..-3]" => nil,
|
||||
}.each do |k,v|
|
||||
swig_assert( "#{k} == #{v.inspect}", "was #{eval(k).inspect}" )
|
||||
swig_assert( "#{k} == #{v.inspect}" )
|
||||
end
|
||||
|
||||
|
||||
swig_assert( "@iv << 5" )
|
||||
swig_assert( "@iv.push 5" )
|
||||
swig_assert( "@iv.pop == 5" )
|
||||
swig_assert( "@iv.insert(1,5)" )
|
||||
swig_assert( "@iv.unshift(7)" )
|
||||
swig_assert( "@iv.shift == 7" )
|
||||
swig_assert( "@iv.insert(0, 3)" )
|
||||
swig_assert( "@iv.unshift(7, 3)" )
|
||||
|
||||
swig_assert( "x = average(@iv)" )
|
||||
swig_assert( "y = average([1, 2, 3, 4])" )
|
||||
|
||||
swig_assert( "half([10, 10.5, 11, 11.5])" )
|
||||
swig_assert_each_line(<<'EOF')
|
||||
@iv << 5
|
||||
@iv.push 5
|
||||
@iv.pop == 5
|
||||
@iv.unshift(7)
|
||||
@iv.shift == 7
|
||||
@iv.unshift(7, 3)
|
||||
@iv.insert(1,5)
|
||||
@iv.insert(0, 3)
|
||||
x = average(@iv)
|
||||
y = average([1, 2, 3, 4])
|
||||
half([10, 10.5, 11, 11.5])
|
||||
EOF
|
||||
|
||||
@dv = DoubleVector.new(10)
|
||||
|
||||
swig_assert( "@dv.respond_to? :each_with_index" )
|
||||
|
||||
@dv.each_with_index { |e,i| swig_assert("#{e} == 0.0", "for @dv[#{i}] == 0") }
|
||||
@dv.each_with_index { |e,i| swig_assert("@dv[#{i}] == 0.0") }
|
||||
|
||||
0.upto(9) { |i| @dv[i] = i/2.0 }
|
||||
|
||||
|
|
@ -72,17 +71,17 @@ swig_assert( "@dv.respond_to? :each_with_index" )
|
|||
"@dv[0,3].to_s" => "0.00.51.0",
|
||||
"@dv[3,3].to_s" => "1.52.02.5",
|
||||
}.each do |k,v|
|
||||
swig_assert( "#{k} == #{v.inspect}", "was #{eval(k).inspect}" )
|
||||
swig_assert( "#{k} == #{v.inspect}" )
|
||||
end
|
||||
|
||||
swig_assert( "@dv.delete_at(2)" )
|
||||
swig_assert( "@dv.delete_if() { |x| x == 2.0 }" )
|
||||
swig_assert_each_line(<<'EOF')
|
||||
@dv.delete_at(2)
|
||||
@dv.delete_if() { |x| x == 2.0 }
|
||||
@dv.include? 3.0
|
||||
@dv.find {|x| x==3.0 }
|
||||
halve_in_place(@dv) == nil
|
||||
@dv = [0.0,0.25,0.75,1.25,1.5,1.75,2.0,2.25]
|
||||
@sv = StructVector.new
|
||||
@sv << Li_std_vector::Struct.new
|
||||
EOF
|
||||
|
||||
swig_assert( "@dv.include? 3.0" )
|
||||
swig_assert( "@dv.find {|x| x==3.0 }" )
|
||||
|
||||
swig_assert( "halve_in_place(@dv) == nil" )
|
||||
swig_assert( "@dv = [0.0,0.25,0.75,1.25,1.5,1.75,2.0,2.25]", "#@dv" )
|
||||
|
||||
swig_assert( "@sv = StructVector.new" )
|
||||
swig_assert( "@sv << C_Struct.new" )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue