Ruby STL container setting slices fixes

Setting an STL container wrapper slice better matches the way Ruby
arrays work. The behaviour is now the same as Ruby arrays. The only
exception is the default value used when expanding a container
cannot be nil as this is not a valid type/value for C++ container
elements.
This commit is contained in:
William S Fulton 2015-11-24 23:58:30 +00:00
commit bb2523a003
4 changed files with 68 additions and 22 deletions

View file

@ -72,13 +72,12 @@ ai = ArrayInt6.new()
compare_containers([0, 0, 0, 0, 0, 0], ai)
# Set slice
#newvals = [10, 20, 30, 40, 50, 60]
#ai[0..5] = newvals
#compare_containers(ai, newvals)
newvals = [10, 20, 30, 40, 50, 60]
ai[0, 6] = newvals
compare_containers(ai, newvals)
#newvals = [10000, 20000, 30000, 40000, 50000, 60000]
#ai[0..100] = newvals
#compare_containers(ai, newvals[0..100])
ai[-6, 6] = newvals
compare_containers(ai, newvals)
setslice_exception(ai, [1, 2, 3, 4, 5, 6, 7])
setslice_exception(ai, [1, 2, 3, 4, 5])