PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/ruby/li_std_map_runme.rb

#
Ruby | 51 lines | 31 code | 12 blank | 8 comment | 3 complexity | e996398c374011a2000891d9b6046060 MD5 | raw file
 1#!/usr/bin/env ruby
 2#
 3# Tests for std::map
 4#
 5# 
 6# 
 7# 
 8#
 9
10require 'swig_assert'
11require 'li_std_map'
12
13swig_assert_each_line(<<'EOF', binding)
14
15a1 = Li_std_map::A.new(3)
16a2 = Li_std_map::A.new(7)
17
18p0 = Li_std_map::Pairii.new(1,2)
19p1 = Li_std_map::PairA.new(1,a1)
20m = {}
21m[1] = a1
22m[2] = a2
23
24pp1 = Li_std_map::p_identa(p1)
25mm = Li_std_map::m_identa(m)
26
27m = Li_std_map::MapA.new
28m[1] = a1
29m[2] = a2
30m.respond_to?(:each_key) == true
31m.respond_to?(:each_value) == true
32
33pm ={}
34m.each_key { |k| pm[k] = m[k] }
35m.each_key { |k| swig_assert_equal("pm[k].object_id", "m[k].object_id", binding, 'only true if %trackings is on') }
36
37m = {}
38m[1] = [1,2]
39m["foo"] = "hello"
40
41pm = Li_std_map::LanguageMap.new
42m.each_key { |k| pm[k] = m[k] }
43m.each_key { |k| swig_assert_equal("pm[#{k.inspect}]", "m[#{k.inspect}]", binding) }
44EOF
45
46mii = Li_std_map::IntIntMap.new
47
48mii[1] = 1
49mii[1] = 2
50
51swig_assert( "mii[1] == 2", binding )