File: naming_runme.rb

package info (click to toggle)
swig1.3 1.3.36-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 27,060 kB
  • ctags: 13,774
  • sloc: cpp: 40,816; ansic: 27,565; python: 9,069; java: 6,432; makefile: 5,065; yacc: 4,916; cs: 4,551; sh: 4,071; ruby: 3,760; perl: 3,562; lisp: 1,993; tcl: 1,266; php: 1,026; ml: 708
file content (115 lines) | stat: -rw-r--r-- 2,558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env ruby
#
# Put description here
#
# 
# 
# 
#

require 'swig_assert'

require 'naming'

# Check class names
if not Naming
  raise RuntimeError, 'Invalid module name for Naming'
end

if not Naming::MyClass
  raise RuntimeError, 'Invalid class name for MyClass'
end


# Check constant names / values
if Naming::CONSTANT1 != 1
  raise RuntimeError, "Incorrect value for CONSTANT1" 
end

if Naming::CONSTANT2 != 2
  raise RuntimeError, "Incorrect value for CONSTANT2" 
end

# Check constant names / values
if Naming::CONSTANT3 != 3
  raise RuntimeError, "Incorrect value for CONSTANT3" 
end

if not Naming::methods.include?("constant4")
  raise RuntimeError, "Incorrect mapping for constant4" 
end

if not Naming::methods.include?("constant5")
  raise RuntimeError, "Incorrect mapping for constant5" 
end

if not Naming::methods.include?("constant6")
  raise RuntimeError, "Incorrect mapping for constant6" 
end

if not Naming::TestConstants.instance_methods.include?("constant7")
  raise RuntimeError, "Incorrect mapping for constant7" 
end

if not Naming::TestConstants.methods.include?("constant8")
  raise RuntimeError, "Incorrect mapping for constant8" 
end

# There is no constant9 because it is illegal C++
#if not Naming::TestConstants.instance_methods.include?("constant9")
#  raise RuntimeError, "Incorrect mapping for constant9" 
#end

if Naming::TestConstants::CONSTANT10 != 10
  raise RuntimeError, "Incorrect value for CONSTANT10" 
end

if not Naming::methods.include?("constant11")
  raise RuntimeError, "Incorrect mapping for constant11" 
end


# Check enums
if Naming::constants.include?("Color")
  raise RuntimeError, "Color enum should not be exposed to Ruby" 
end

if Naming::Red != 0
  raise RuntimeError, "Incorrect value for enum RED" 
end

if Naming::Green != 1
  raise RuntimeError, "Incorrect value for enum GREEN" 
end

if Naming::Blue != 2
  raise RuntimeError, "Incorrect value for enum BLUE" 
end


# Check method names
my_class = Naming::MyClass.new()

if my_class.method_one != 1 
  raise RuntimeError, "Incorrect value for method_one" 
end
  
if my_class.method_two != 2
  raise RuntimeError, "Incorrect value for method_two" 
end

if my_class.method_three != 3
  raise RuntimeError, "Incorrect value for method_three" 
end

if my_class.method_44_4 != 4
  raise RuntimeError, "Incorrect value for method_44_4" 
end

if my_class.predicate_method? != true
  raise RuntimeError, "Incorrect value for predicate_method?" 
end

if my_class.bang_method! != true
  raise RuntimeError, "Incorrect value for bang_method!" 
end