@@ -50,4 +50,136 @@ SUITE( fbc_tests.overload_.const_ )
5050 END_TEST
5151 END_TEST_GROUP
5252
53+ dim shared axlong( 1 to ...) as long = { 1 , 2 }
54+ dim shared axlongint( 1 to ...) as longint = { 1 , 2 }
55+ dim shared axinteger( 1 to ...) as integer = { 1 , 2 }
56+ dim shared axsingle( 1 to ...) as single = { 1 . 0 f, 2 . 0 f}
57+ dim shared axdouble( 1 to ...) as double = { 1 . 0 , 2 . 0 }
58+
59+ dim shared axconstlong( 1 to ...) as const long = { 1 , 2 }
60+ dim shared axconstlongint( 1 to ...) as const longint = { 1 , 2 }
61+ dim shared axconstinteger( 1 to ...) as const integer = { 1 , 2 }
62+ dim shared axconstsingle( 1 to ...) as const single = { 1 . 0 f, 2 . 0 f}
63+ dim shared axconstdouble( 1 to ...) as const double = { 1 . 0 , 2 . 0 }
64+
65+ dim shared axconstbyte( 1 to ...) as const byte = { 1 , 2 }
66+
67+ TEST_GROUP( array )
68+
69+ function f overload( x() as integer ) as string : function = "integer" : end function
70+ function f overload( x() as longint ) as string : function = "longint" : end function
71+ function f overload( x() as single ) as string : function = "single" : end function
72+ function f overload( x() as double ) as string : function = "double" : end function
73+ function f overload( x() as long ) as string : function = "long" : end function
74+
75+ TEST( non_const_array )
76+ CU_ASSERT( f( axlong() ) = "long" )
77+ CU_ASSERT( f( axlongint() ) = "longint" )
78+ CU_ASSERT( f( axinteger() ) = "integer" )
79+ CU_ASSERT( f( axsingle() ) = "single" )
80+ CU_ASSERT( f( axdouble() ) = "double" )
81+ END_TEST
82+
83+ function fc overload( x() as const integer ) as string : function = "integer" : end function
84+ function fc overload( x() as const longint ) as string : function = "longint" : end function
85+ function fc overload( x() as const single ) as string : function = "single" : end function
86+ function fc overload( x() as const double ) as string : function = "double" : end function
87+ function fc overload( x() as const long ) as string : function = "long" : end function
88+
89+ TEST( const_array )
90+ CU_ASSERT( fc( axlong() ) = "long" )
91+ CU_ASSERT( fc( axlongint() ) = "longint" )
92+ CU_ASSERT( fc( axinteger() ) = "integer" )
93+ CU_ASSERT( fc( axsingle() ) = "single" )
94+ CU_ASSERT( fc( axdouble() ) = "double" )
95+ CU_ASSERT( fc( axconstlong() ) = "long" )
96+ CU_ASSERT( fc( axconstlongint() ) = "longint" )
97+ CU_ASSERT( fc( axconstinteger() ) = "integer" )
98+ CU_ASSERT( fc( axconstsingle() ) = "single" )
99+ CU_ASSERT( fc( axconstdouble() ) = "double" )
100+ END_TEST
101+
102+ END_TEST_GROUP
103+
104+ TEST_GROUP( array )
105+
106+ '' base test using scalars
107+ function f0 overload( byref a as integer , byval x as integer ) as string
108+ function = "integer, integer"
109+ end function
110+ function f0 overload( byref a as integer , byval x as double ) as string
111+ function = "integer, double"
112+ end function
113+
114+ function f1 overload( byref a as const integer , byval x as integer ) as string
115+ function = "const integer, integer"
116+ end function
117+ function f1 overload( byref a as const integer , byval x as double ) as string
118+ function = "const integer, double"
119+ end function
120+
121+ '' array() tests
122+ function f2 overload( a() as integer , byval x as integer ) as string
123+ function = "() const integer, integer"
124+ end function
125+ function f2 overload( a() as integer , byval x as double ) as string
126+ function = "() const integer, double"
127+ end function
128+
129+ function f3 overload( a() as const integer , byval x as integer ) as string
130+ function = "() const integer, integer"
131+ end function
132+ function f3 overload( a() as const integer , byval x as double ) as string
133+ function = "() const integer, double"
134+ end function
135+
136+ function f4 overload( a() as integer , byval x as integer ) as string
137+ function = "() integer, integer"
138+ end function
139+ function f4 overload( a() as const integer , byval x as double ) as string
140+ function = "() const integer, double"
141+ end function
142+
143+ function f5 overload( a() as const integer , byval x as integer ) as string
144+ function = "() const integer, integer"
145+ end function
146+ function f5 overload( a() as integer , byval x as double ) as string
147+ function = "() integer, double"
148+ end function
149+
150+ TEST( array_number )
151+
152+ dim a( 1 to ... ) as integer = { 1 , 2 }
153+ dim ca( 1 to ...) as const integer = { 1 , 2 }
154+ dim i as integer , ci as const integer = 1
155+ dim d as double
156+
157+ CU_ASSERT( f0( i, i ) = "integer, integer" )
158+ CU_ASSERT( f0( i, d ) = "integer, double" )
159+
160+ CU_ASSERT( f1( ci, i ) = "const integer, integer" )
161+ CU_ASSERT( f1( ci, d ) = "const integer, double" )
162+
163+ CU_ASSERT( f2( a(), i ) = "() const integer, integer" )
164+ CU_ASSERT( f2( a(), d ) = "() const integer, double" )
165+
166+ CU_ASSERT( f3( a(), i ) = "() const integer, integer" )
167+ CU_ASSERT( f3( ca(), i ) = "() const integer, integer" )
168+ CU_ASSERT( f3( a(), d ) = "() const integer, double" )
169+ CU_ASSERT( f3( ca(), d ) = "() const integer, double" )
170+
171+ CU_ASSERT( f4( a(), i ) = "() integer, integer" )
172+ CU_ASSERT( f4( ca(), i ) = "() const integer, double" )
173+ CU_ASSERT( f4( a(), d ) = "() const integer, double" )
174+ CU_ASSERT( f4( ca(), d ) = "() const integer, double" )
175+
176+ CU_ASSERT( f5( a(), i ) = "() const integer, integer" )
177+ CU_ASSERT( f5( ca(), i ) = "() const integer, integer" )
178+ CU_ASSERT( f5( a(), d ) = "() integer, double" )
179+ CU_ASSERT( f5( ca(), d ) = "() const integer, integer" )
180+
181+ END_TEST
182+
183+ END_TEST_GROUP
184+
53185END_SUITE
0 commit comments