Merge branch 'master' into doxygen

Merge with ~3.0.1 sources from master.
This commit is contained in:
Vadim Zeitlin 2014-04-30 18:37:57 +02:00
commit 1ebd2334b8
1593 changed files with 51732 additions and 28076 deletions

View file

@ -61,7 +61,7 @@ ruby_naming.cpptest: SWIGOPT += -autorename
# a file is found which has _runme.rb appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) -I$(srcdir):. $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean

View file

@ -1,5 +1,5 @@
#!/usr/bin/env ruby
#
#Encoding: ASCII-8BIT
# Put description here
#
#

View file

@ -34,6 +34,12 @@ def _set(container)
EOF
end
def b_lessthan_a(b, a)
res = b < a
# print b, "<", a, "=", res
return res
end
def _map(container)
swig_assert_each_line(<<EOF, binding)
cont = #{container}.new
@ -43,7 +49,7 @@ def _map(container)
cont['w'] = 2
cont.to_a == [['w',2],['x',8],['y',1],['z',9]]
cont = #{container}.new(proc { |a,b| b < a } )
cont = #{container}.new(proc { |a,b| b_lessthan_a(b, a) } )
cont['z'] = 9
cont['y'] = 1
cont['x'] = 8

View file

@ -57,7 +57,14 @@ s = LanguageSet.new
s.insert([1,2])
s.insert(1)
s.insert("hello")
s.to_a == [1,[1,2],'hello'] # sort order: s.sort {|a,b| a.hash <=> b.hash}
#s.to_a == [1,[1,2],'hello'] # sort order: s.sort {|a,b| a.hash <=> b.hash}
# Test above is flawed as LanguageSet sorts by each element's hash, so the order will change from one invocation to the next. Sort a conversion to array instead.
sa = s.to_a.sort { |x, y| x.to_s <=> y.to_s }
sa == [1,[1,2],'hello']
EOF
iv = Set_int.new([0,1,2,3,4,5,6])
iv.delete_if { |x| x == 0 || x == 3 || x == 6 }
swig_assert_equal(iv.to_s, '1245', binding)

View file

@ -64,6 +64,11 @@ y = average([1, 2, 3, 4])
half([10, 10.5, 11, 11.5])
EOF
iv = IntVector.new([0,1,2,3,4,5,6])
iv.delete_if { |x| x == 0 || x == 3 || x == 6 }
swig_assert_equal(iv.to_s, '1245', binding)
dv = DoubleVector.new(10)
swig_assert( "dv.respond_to? :each_with_index", binding )

View file

@ -0,0 +1,88 @@
#!/usr/bin/env ruby
#
# Put description here
#
#
#
#
#
require 'swig_assert'
require 'overload_bool'
include Overload_bool
# Overloading bool, int, string
if overloaded(true) != "bool"
raise RuntimeError, "wrong!"
end
if overloaded(false) != "bool"
raise RuntimeError, "wrong!"
end
if overloaded(0) != "int"
raise RuntimeError, "wrong!"
end
if overloaded(1) != "int"
raise RuntimeError, "wrong!"
end
if overloaded(2) != "int"
raise RuntimeError, "wrong!"
end
if overloaded("1234") != "string"
raise RuntimeError, "wrong!"
end
# Test bool masquerading as integer
# Not possible
# Test int masquerading as bool
if boolfunction(0) != "false"
raise RuntimeError, "wrong!"
end
if boolfunction(1) != "true"
raise RuntimeError, "wrong!"
end
if boolfunction(2) != "true"
raise RuntimeError, "wrong!"
end
#############################################
# Overloading bool, int, string
if overloaded_ref(true) != "bool"
raise RuntimeError, "wrong!"
end
if overloaded_ref(false) != "bool"
raise RuntimeError, "wrong!"
end
if overloaded_ref(0) != "int"
raise RuntimeError, "wrong!"
end
if overloaded_ref(1) != "int"
raise RuntimeError, "wrong!"
end
if overloaded_ref(2) != "int"
raise RuntimeError, "wrong!"
end
if overloaded_ref("1234") != "string"
raise RuntimeError, "wrong!"
end
# Test bool masquerading as integer
# Not possible
# Test int masquerading as bool
if boolfunction_ref(0) != "false"
raise RuntimeError, "wrong!"
end
if boolfunction_ref(1) != "true"
raise RuntimeError, "wrong!"
end
if boolfunction_ref(2) != "true"
raise RuntimeError, "wrong!"
end

View file

@ -35,23 +35,23 @@ if Ruby_naming::CONSTANT3 != 3
raise RuntimeError, "Incorrect value for CONSTANT3"
end
if not Ruby_naming::methods.include?("constant4")
if not (Ruby_naming::methods.include?("constant4") || Ruby_naming::methods.include?(:constant4))
raise RuntimeError, "Incorrect mapping for constant4"
end
if not Ruby_naming::methods.include?("constant5")
if not (Ruby_naming::methods.include?("constant5") || Ruby_naming::methods.include?(:constant5))
raise RuntimeError, "Incorrect mapping for constant5"
end
if not Ruby_naming::methods.include?("constant6")
if not (Ruby_naming::methods.include?("constant6") || Ruby_naming::methods.include?(:constant6))
raise RuntimeError, "Incorrect mapping for constant6"
end
if not Ruby_naming::TestConstants.instance_methods.include?("constant7")
if not (Ruby_naming::TestConstants.instance_methods.include?("constant7") || Ruby_naming::TestConstants.instance_methods.include?(:constant7))
raise RuntimeError, "Incorrect mapping for constant7"
end
if not Ruby_naming::TestConstants.methods.include?("constant8")
if not (Ruby_naming::TestConstants.methods.include?("constant8") || Ruby_naming::TestConstants.methods.include?(:constant8))
raise RuntimeError, "Incorrect mapping for constant8"
end
@ -64,7 +64,7 @@ if Ruby_naming::TestConstants::CONSTANT10 != 10
raise RuntimeError, "Incorrect value for CONSTANT10"
end
if not Ruby_naming::methods.include?("constant11")
if not (Ruby_naming::methods.include?("constant11") || Ruby_naming::methods.include?(:constant11))
raise RuntimeError, "Incorrect mapping for constant11"
end