• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2012 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 /**
25  * \file enum_sizes.cpp
26  * Validate the generated code in indirect_size.c
27  *
28  * The functions in indirect_size.c determine how many data values are
29  * associated with each enumerant that can be passed to various OpenGL
30  * functions.  Tests in this file probe each function in indirect_size.c with
31  * each of the possible valid enums and verify that the correct size is
32  * returned.  Tests in this file also probe each function in indirect_size.c
33  * with a larger number of \b invalid enums and verify that zero is returned.
34  */
35 
36 #include <gtest/gtest.h>
37 #include <GL/gl.h>
38 extern "C" {
39 #include "indirect_size.h"
40 }
41 
TEST(ValidEnumSizes,CallLists)42 TEST(ValidEnumSizes, CallLists)
43 {
44    EXPECT_EQ(1, __glCallLists_size(GL_BYTE));
45    EXPECT_EQ(1, __glCallLists_size(GL_UNSIGNED_BYTE));
46    EXPECT_EQ(2, __glCallLists_size(GL_SHORT));
47    EXPECT_EQ(2, __glCallLists_size(GL_UNSIGNED_SHORT));
48    EXPECT_EQ(2, __glCallLists_size(GL_2_BYTES));
49    EXPECT_EQ(2, __glCallLists_size(GL_HALF_FLOAT));
50    EXPECT_EQ(3, __glCallLists_size(GL_3_BYTES));
51    EXPECT_EQ(4, __glCallLists_size(GL_INT));
52    EXPECT_EQ(4, __glCallLists_size(GL_UNSIGNED_INT));
53    EXPECT_EQ(4, __glCallLists_size(GL_FLOAT));
54    EXPECT_EQ(4, __glCallLists_size(GL_4_BYTES));
55 }
56 
TEST(InvalidEnumSizes,CallLists)57 TEST(InvalidEnumSizes, CallLists)
58 {
59    for (unsigned i = 0; i < 0x10004; i++) {
60       switch (i) {
61       case GL_BYTE:
62       case GL_UNSIGNED_BYTE:
63       case GL_SHORT:
64       case GL_UNSIGNED_SHORT:
65       case GL_2_BYTES:
66       case GL_HALF_FLOAT:
67       case GL_3_BYTES:
68       case GL_INT:
69       case GL_UNSIGNED_INT:
70       case GL_FLOAT:
71       case GL_4_BYTES:
72          break;
73       default:
74          EXPECT_EQ(0, __glCallLists_size(i)) << "i = 0x" <<
75             std::setw(4) << std::setfill('0') << std::hex << i;
76       }
77    }
78 }
79 
TEST(ValidEnumSizes,Fogfv)80 TEST(ValidEnumSizes, Fogfv)
81 {
82    EXPECT_EQ(1, __glFogfv_size(GL_FOG_INDEX));
83    EXPECT_EQ(1, __glFogfv_size(GL_FOG_DENSITY));
84    EXPECT_EQ(1, __glFogfv_size(GL_FOG_START));
85    EXPECT_EQ(1, __glFogfv_size(GL_FOG_END));
86    EXPECT_EQ(1, __glFogfv_size(GL_FOG_MODE));
87    EXPECT_EQ(1, __glFogfv_size(GL_FOG_OFFSET_VALUE_SGIX));
88    EXPECT_EQ(1, __glFogfv_size(GL_FOG_DISTANCE_MODE_NV));
89    EXPECT_EQ(4, __glFogfv_size(GL_FOG_COLOR));
90 }
91 
TEST(InvalidEnumSizes,Fogfv)92 TEST(InvalidEnumSizes, Fogfv)
93 {
94    for (unsigned i = 0; i < 0x10004; i++) {
95       switch (i) {
96       case GL_FOG_INDEX:
97       case GL_FOG_DENSITY:
98       case GL_FOG_START:
99       case GL_FOG_END:
100       case GL_FOG_MODE:
101       case GL_FOG_OFFSET_VALUE_SGIX:
102       case GL_FOG_DISTANCE_MODE_NV:
103       case GL_FOG_COLOR:
104          break;
105       default:
106          EXPECT_EQ(0, __glFogfv_size(i)) << "i = 0x" <<
107             std::setw(4) << std::setfill('0') << std::hex << i;
108       }
109    }
110 }
111 
TEST(ValidEnumSizes,Lightfv)112 TEST(ValidEnumSizes, Lightfv)
113 {
114    EXPECT_EQ(1, __glLightfv_size(GL_SPOT_EXPONENT));
115    EXPECT_EQ(1, __glLightfv_size(GL_SPOT_CUTOFF));
116    EXPECT_EQ(1, __glLightfv_size(GL_CONSTANT_ATTENUATION));
117    EXPECT_EQ(1, __glLightfv_size(GL_LINEAR_ATTENUATION));
118    EXPECT_EQ(1, __glLightfv_size(GL_QUADRATIC_ATTENUATION));
119    EXPECT_EQ(3, __glLightfv_size(GL_SPOT_DIRECTION));
120    EXPECT_EQ(4, __glLightfv_size(GL_AMBIENT));
121    EXPECT_EQ(4, __glLightfv_size(GL_DIFFUSE));
122    EXPECT_EQ(4, __glLightfv_size(GL_SPECULAR));
123    EXPECT_EQ(4, __glLightfv_size(GL_POSITION));
124 }
125 
TEST(InvalidEnumSizes,Lightfv)126 TEST(InvalidEnumSizes, Lightfv)
127 {
128    for (unsigned i = 0; i < 0x10004; i++) {
129       switch (i) {
130       case GL_SPOT_EXPONENT:
131       case GL_SPOT_CUTOFF:
132       case GL_CONSTANT_ATTENUATION:
133       case GL_LINEAR_ATTENUATION:
134       case GL_QUADRATIC_ATTENUATION:
135       case GL_SPOT_DIRECTION:
136       case GL_AMBIENT:
137       case GL_DIFFUSE:
138       case GL_SPECULAR:
139       case GL_POSITION:
140          break;
141       default:
142          EXPECT_EQ(0, __glLightfv_size(i)) << "i = 0x" <<
143             std::setw(4) << std::setfill('0') << std::hex << i;
144       }
145    }
146 }
147 
TEST(ValidEnumSizes,LightModelfv)148 TEST(ValidEnumSizes, LightModelfv)
149 {
150    EXPECT_EQ(1, __glLightModelfv_size(GL_LIGHT_MODEL_LOCAL_VIEWER));
151    EXPECT_EQ(1, __glLightModelfv_size(GL_LIGHT_MODEL_TWO_SIDE));
152    EXPECT_EQ(1, __glLightModelfv_size(GL_LIGHT_MODEL_COLOR_CONTROL));
153    EXPECT_EQ(1, __glLightModelfv_size(GL_LIGHT_MODEL_COLOR_CONTROL_EXT));
154    EXPECT_EQ(4, __glLightModelfv_size(GL_LIGHT_MODEL_AMBIENT));
155 }
156 
TEST(InvalidEnumSizes,LightModelfv)157 TEST(InvalidEnumSizes, LightModelfv)
158 {
159    for (unsigned i = 0; i < 0x10004; i++) {
160       switch (i) {
161       case GL_LIGHT_MODEL_LOCAL_VIEWER:
162       case GL_LIGHT_MODEL_TWO_SIDE:
163       case GL_LIGHT_MODEL_COLOR_CONTROL:
164 /*      case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/
165       case GL_LIGHT_MODEL_AMBIENT:
166          break;
167       default:
168          EXPECT_EQ(0, __glLightModelfv_size(i)) << "i = 0x" <<
169             std::setw(4) << std::setfill('0') << std::hex << i;
170       }
171    }
172 }
173 
TEST(ValidEnumSizes,Materialfv)174 TEST(ValidEnumSizes, Materialfv)
175 {
176    EXPECT_EQ(1, __glMaterialfv_size(GL_SHININESS));
177    EXPECT_EQ(3, __glMaterialfv_size(GL_COLOR_INDEXES));
178    EXPECT_EQ(4, __glMaterialfv_size(GL_AMBIENT));
179    EXPECT_EQ(4, __glMaterialfv_size(GL_DIFFUSE));
180    EXPECT_EQ(4, __glMaterialfv_size(GL_SPECULAR));
181    EXPECT_EQ(4, __glMaterialfv_size(GL_EMISSION));
182    EXPECT_EQ(4, __glMaterialfv_size(GL_AMBIENT_AND_DIFFUSE));
183 }
184 
TEST(InvalidEnumSizes,Materialfv)185 TEST(InvalidEnumSizes, Materialfv)
186 {
187    for (unsigned i = 0; i < 0x10004; i++) {
188       switch (i) {
189       case GL_SHININESS:
190       case GL_COLOR_INDEXES:
191       case GL_AMBIENT:
192       case GL_DIFFUSE:
193       case GL_SPECULAR:
194       case GL_EMISSION:
195       case GL_AMBIENT_AND_DIFFUSE:
196          break;
197       default:
198          EXPECT_EQ(0, __glMaterialfv_size(i)) << "i = 0x" <<
199             std::setw(4) << std::setfill('0') << std::hex << i;
200       }
201    }
202 }
203 
TEST(ValidEnumSizes,TexParameterfv)204 TEST(ValidEnumSizes, TexParameterfv)
205 {
206    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MAG_FILTER));
207    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MIN_FILTER));
208    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_WRAP_S));
209    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_WRAP_T));
210    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_PRIORITY));
211    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_WRAP_R));
212    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_COMPARE_FAIL_VALUE_ARB));
213    EXPECT_EQ(1, __glTexParameterfv_size(GL_SHADOW_AMBIENT_SGIX));
214    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MIN_LOD));
215    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MAX_LOD));
216    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_BASE_LEVEL));
217    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MAX_LEVEL));
218    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_CLIPMAP_FRAME_SGIX));
219    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_LOD_BIAS_S_SGIX));
220    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_LOD_BIAS_T_SGIX));
221    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_LOD_BIAS_R_SGIX));
222    EXPECT_EQ(1, __glTexParameterfv_size(GL_GENERATE_MIPMAP));
223    EXPECT_EQ(1, __glTexParameterfv_size(GL_GENERATE_MIPMAP_SGIS));
224    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_COMPARE_SGIX));
225    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_COMPARE_OPERATOR_SGIX));
226    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MAX_CLAMP_S_SGIX));
227    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MAX_CLAMP_T_SGIX));
228    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MAX_CLAMP_R_SGIX));
229    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_MAX_ANISOTROPY_EXT));
230    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_LOD_BIAS));
231    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_LOD_BIAS_EXT));
232    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_STORAGE_HINT_APPLE));
233    EXPECT_EQ(1, __glTexParameterfv_size(GL_STORAGE_PRIVATE_APPLE));
234    EXPECT_EQ(1, __glTexParameterfv_size(GL_STORAGE_CACHED_APPLE));
235    EXPECT_EQ(1, __glTexParameterfv_size(GL_STORAGE_SHARED_APPLE));
236    EXPECT_EQ(1, __glTexParameterfv_size(GL_DEPTH_TEXTURE_MODE));
237    EXPECT_EQ(1, __glTexParameterfv_size(GL_DEPTH_TEXTURE_MODE_ARB));
238    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_COMPARE_MODE));
239    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_COMPARE_MODE_ARB));
240    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_COMPARE_FUNC));
241    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_COMPARE_FUNC_ARB));
242    EXPECT_EQ(1, __glTexParameterfv_size(GL_TEXTURE_UNSIGNED_REMAP_MODE_NV));
243    EXPECT_EQ(2, __glTexParameterfv_size(GL_TEXTURE_CLIPMAP_CENTER_SGIX));
244    EXPECT_EQ(2, __glTexParameterfv_size(GL_TEXTURE_CLIPMAP_OFFSET_SGIX));
245    EXPECT_EQ(3, __glTexParameterfv_size(GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX));
246    EXPECT_EQ(4, __glTexParameterfv_size(GL_TEXTURE_BORDER_COLOR));
247    EXPECT_EQ(4, __glTexParameterfv_size(GL_POST_TEXTURE_FILTER_BIAS_SGIX));
248    EXPECT_EQ(4, __glTexParameterfv_size(GL_POST_TEXTURE_FILTER_SCALE_SGIX));
249 }
250 
TEST(InvalidEnumSizes,TexParameterfv)251 TEST(InvalidEnumSizes, TexParameterfv)
252 {
253    for (unsigned i = 0; i < 0x10004; i++) {
254       switch (i) {
255       case GL_TEXTURE_MAG_FILTER:
256       case GL_TEXTURE_MIN_FILTER:
257       case GL_TEXTURE_WRAP_S:
258       case GL_TEXTURE_WRAP_T:
259       case GL_TEXTURE_PRIORITY:
260       case GL_TEXTURE_WRAP_R:
261       case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
262 /*      case GL_SHADOW_AMBIENT_SGIX:*/
263       case GL_TEXTURE_MIN_LOD:
264       case GL_TEXTURE_MAX_LOD:
265       case GL_TEXTURE_BASE_LEVEL:
266       case GL_TEXTURE_MAX_LEVEL:
267       case GL_TEXTURE_CLIPMAP_FRAME_SGIX:
268       case GL_TEXTURE_LOD_BIAS_S_SGIX:
269       case GL_TEXTURE_LOD_BIAS_T_SGIX:
270       case GL_TEXTURE_LOD_BIAS_R_SGIX:
271       case GL_GENERATE_MIPMAP:
272 /*      case GL_GENERATE_MIPMAP_SGIS:*/
273       case GL_TEXTURE_COMPARE_SGIX:
274       case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
275       case GL_TEXTURE_MAX_CLAMP_S_SGIX:
276       case GL_TEXTURE_MAX_CLAMP_T_SGIX:
277       case GL_TEXTURE_MAX_CLAMP_R_SGIX:
278       case GL_TEXTURE_MAX_ANISOTROPY_EXT:
279       case GL_TEXTURE_LOD_BIAS:
280 /*      case GL_TEXTURE_LOD_BIAS_EXT:*/
281       case GL_TEXTURE_STORAGE_HINT_APPLE:
282       case GL_STORAGE_PRIVATE_APPLE:
283       case GL_STORAGE_CACHED_APPLE:
284       case GL_STORAGE_SHARED_APPLE:
285       case GL_DEPTH_TEXTURE_MODE:
286 /*      case GL_DEPTH_TEXTURE_MODE_ARB:*/
287       case GL_TEXTURE_COMPARE_MODE:
288 /*      case GL_TEXTURE_COMPARE_MODE_ARB:*/
289       case GL_TEXTURE_COMPARE_FUNC:
290 /*      case GL_TEXTURE_COMPARE_FUNC_ARB:*/
291       case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV:
292       case GL_TEXTURE_CLIPMAP_CENTER_SGIX:
293       case GL_TEXTURE_CLIPMAP_OFFSET_SGIX:
294       case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX:
295       case GL_TEXTURE_BORDER_COLOR:
296       case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
297       case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
298          break;
299       default:
300          EXPECT_EQ(0, __glTexParameterfv_size(i)) << "i = 0x" <<
301             std::setw(4) << std::setfill('0') << std::hex << i;
302       }
303    }
304 }
305 
TEST(ValidEnumSizes,TexEnvfv)306 TEST(ValidEnumSizes, TexEnvfv)
307 {
308    EXPECT_EQ(1, __glTexEnvfv_size(GL_ALPHA_SCALE));
309    EXPECT_EQ(1, __glTexEnvfv_size(GL_TEXTURE_ENV_MODE));
310    EXPECT_EQ(1, __glTexEnvfv_size(GL_TEXTURE_LOD_BIAS));
311    EXPECT_EQ(1, __glTexEnvfv_size(GL_COMBINE_RGB));
312    EXPECT_EQ(1, __glTexEnvfv_size(GL_COMBINE_ALPHA));
313    EXPECT_EQ(1, __glTexEnvfv_size(GL_RGB_SCALE));
314    EXPECT_EQ(1, __glTexEnvfv_size(GL_SOURCE0_RGB));
315    EXPECT_EQ(1, __glTexEnvfv_size(GL_SOURCE1_RGB));
316    EXPECT_EQ(1, __glTexEnvfv_size(GL_SOURCE2_RGB));
317    EXPECT_EQ(1, __glTexEnvfv_size(GL_SOURCE3_RGB_NV));
318    EXPECT_EQ(1, __glTexEnvfv_size(GL_SOURCE0_ALPHA));
319    EXPECT_EQ(1, __glTexEnvfv_size(GL_SOURCE1_ALPHA));
320    EXPECT_EQ(1, __glTexEnvfv_size(GL_SOURCE2_ALPHA));
321    EXPECT_EQ(1, __glTexEnvfv_size(GL_SOURCE3_ALPHA_NV));
322    EXPECT_EQ(1, __glTexEnvfv_size(GL_OPERAND0_RGB));
323    EXPECT_EQ(1, __glTexEnvfv_size(GL_OPERAND1_RGB));
324    EXPECT_EQ(1, __glTexEnvfv_size(GL_OPERAND2_RGB));
325    EXPECT_EQ(1, __glTexEnvfv_size(GL_OPERAND3_RGB_NV));
326    EXPECT_EQ(1, __glTexEnvfv_size(GL_OPERAND0_ALPHA));
327    EXPECT_EQ(1, __glTexEnvfv_size(GL_OPERAND1_ALPHA));
328    EXPECT_EQ(1, __glTexEnvfv_size(GL_OPERAND2_ALPHA));
329    EXPECT_EQ(1, __glTexEnvfv_size(GL_OPERAND3_ALPHA_NV));
330    EXPECT_EQ(1, __glTexEnvfv_size(GL_BUMP_TARGET_ATI));
331    EXPECT_EQ(1, __glTexEnvfv_size(GL_COORD_REPLACE_ARB));
332    EXPECT_EQ(1, __glTexEnvfv_size(GL_COORD_REPLACE_NV));
333    EXPECT_EQ(4, __glTexEnvfv_size(GL_TEXTURE_ENV_COLOR));
334 }
335 
TEST(InvalidEnumSizes,TexEnvfv)336 TEST(InvalidEnumSizes, TexEnvfv)
337 {
338    for (unsigned i = 0; i < 0x10004; i++) {
339       switch (i) {
340       case GL_ALPHA_SCALE:
341       case GL_TEXTURE_ENV_MODE:
342       case GL_TEXTURE_LOD_BIAS:
343       case GL_COMBINE_RGB:
344       case GL_COMBINE_ALPHA:
345       case GL_RGB_SCALE:
346       case GL_SOURCE0_RGB:
347       case GL_SOURCE1_RGB:
348       case GL_SOURCE2_RGB:
349       case GL_SOURCE3_RGB_NV:
350       case GL_SOURCE0_ALPHA:
351       case GL_SOURCE1_ALPHA:
352       case GL_SOURCE2_ALPHA:
353       case GL_SOURCE3_ALPHA_NV:
354       case GL_OPERAND0_RGB:
355       case GL_OPERAND1_RGB:
356       case GL_OPERAND2_RGB:
357       case GL_OPERAND3_RGB_NV:
358       case GL_OPERAND0_ALPHA:
359       case GL_OPERAND1_ALPHA:
360       case GL_OPERAND2_ALPHA:
361       case GL_OPERAND3_ALPHA_NV:
362       case GL_BUMP_TARGET_ATI:
363       case GL_COORD_REPLACE_ARB:
364 /*      case GL_COORD_REPLACE_NV:*/
365       case GL_TEXTURE_ENV_COLOR:
366          break;
367       default:
368          EXPECT_EQ(0, __glTexEnvfv_size(i)) << "i = 0x" <<
369             std::setw(4) << std::setfill('0') << std::hex << i;
370       }
371    }
372 }
373 
TEST(ValidEnumSizes,TexGendv)374 TEST(ValidEnumSizes, TexGendv)
375 {
376    EXPECT_EQ(1, __glTexGendv_size(GL_TEXTURE_GEN_MODE));
377    EXPECT_EQ(4, __glTexGendv_size(GL_OBJECT_PLANE));
378    EXPECT_EQ(4, __glTexGendv_size(GL_EYE_PLANE));
379 }
380 
TEST(InvalidEnumSizes,TexGendv)381 TEST(InvalidEnumSizes, TexGendv)
382 {
383    for (unsigned i = 0; i < 0x10004; i++) {
384       switch (i) {
385       case GL_TEXTURE_GEN_MODE:
386       case GL_OBJECT_PLANE:
387       case GL_EYE_PLANE:
388          break;
389       default:
390          EXPECT_EQ(0, __glTexGendv_size(i)) << "i = 0x" <<
391             std::setw(4) << std::setfill('0') << std::hex << i;
392       }
393    }
394 }
395 
TEST(ValidEnumSizes,Map1d)396 TEST(ValidEnumSizes, Map1d)
397 {
398    EXPECT_EQ(1, __glMap1d_size(GL_MAP1_INDEX));
399    EXPECT_EQ(1, __glMap1d_size(GL_MAP1_TEXTURE_COORD_1));
400    EXPECT_EQ(2, __glMap1d_size(GL_MAP1_TEXTURE_COORD_2));
401    EXPECT_EQ(3, __glMap1d_size(GL_MAP1_NORMAL));
402    EXPECT_EQ(3, __glMap1d_size(GL_MAP1_TEXTURE_COORD_3));
403    EXPECT_EQ(3, __glMap1d_size(GL_MAP1_VERTEX_3));
404    EXPECT_EQ(4, __glMap1d_size(GL_MAP1_COLOR_4));
405    EXPECT_EQ(4, __glMap1d_size(GL_MAP1_TEXTURE_COORD_4));
406    EXPECT_EQ(4, __glMap1d_size(GL_MAP1_VERTEX_4));
407 }
408 
TEST(InvalidEnumSizes,Map1d)409 TEST(InvalidEnumSizes, Map1d)
410 {
411    for (unsigned i = 0; i < 0x10004; i++) {
412       switch (i) {
413       case GL_MAP1_INDEX:
414       case GL_MAP1_TEXTURE_COORD_1:
415       case GL_MAP1_TEXTURE_COORD_2:
416       case GL_MAP1_NORMAL:
417       case GL_MAP1_TEXTURE_COORD_3:
418       case GL_MAP1_VERTEX_3:
419       case GL_MAP1_COLOR_4:
420       case GL_MAP1_TEXTURE_COORD_4:
421       case GL_MAP1_VERTEX_4:
422          break;
423       default:
424          EXPECT_EQ(0, __glMap1d_size(i)) << "i = 0x" <<
425             std::setw(4) << std::setfill('0') << std::hex << i;
426       }
427    }
428 }
429 
TEST(ValidEnumSizes,Map2d)430 TEST(ValidEnumSizes, Map2d)
431 {
432    EXPECT_EQ(1, __glMap2d_size(GL_MAP2_INDEX));
433    EXPECT_EQ(1, __glMap2d_size(GL_MAP2_TEXTURE_COORD_1));
434    EXPECT_EQ(2, __glMap2d_size(GL_MAP2_TEXTURE_COORD_2));
435    EXPECT_EQ(3, __glMap2d_size(GL_MAP2_NORMAL));
436    EXPECT_EQ(3, __glMap2d_size(GL_MAP2_TEXTURE_COORD_3));
437    EXPECT_EQ(3, __glMap2d_size(GL_MAP2_VERTEX_3));
438    EXPECT_EQ(4, __glMap2d_size(GL_MAP2_COLOR_4));
439    EXPECT_EQ(4, __glMap2d_size(GL_MAP2_TEXTURE_COORD_4));
440    EXPECT_EQ(4, __glMap2d_size(GL_MAP2_VERTEX_4));
441 }
442 
TEST(InvalidEnumSizes,Map2d)443 TEST(InvalidEnumSizes, Map2d)
444 {
445    for (unsigned i = 0; i < 0x10004; i++) {
446       switch (i) {
447       case GL_MAP2_INDEX:
448       case GL_MAP2_TEXTURE_COORD_1:
449       case GL_MAP2_TEXTURE_COORD_2:
450       case GL_MAP2_NORMAL:
451       case GL_MAP2_TEXTURE_COORD_3:
452       case GL_MAP2_VERTEX_3:
453       case GL_MAP2_COLOR_4:
454       case GL_MAP2_TEXTURE_COORD_4:
455       case GL_MAP2_VERTEX_4:
456          break;
457       default:
458          EXPECT_EQ(0, __glMap2d_size(i)) << "i = 0x" <<
459             std::setw(4) << std::setfill('0') << std::hex << i;
460       }
461    }
462 }
463 
TEST(ValidEnumSizes,ColorTableParameterfv)464 TEST(ValidEnumSizes, ColorTableParameterfv)
465 {
466    EXPECT_EQ(4, __glColorTableParameterfv_size(GL_COLOR_TABLE_SCALE));
467    EXPECT_EQ(4, __glColorTableParameterfv_size(GL_COLOR_TABLE_BIAS));
468 }
469 
TEST(InvalidEnumSizes,ColorTableParameterfv)470 TEST(InvalidEnumSizes, ColorTableParameterfv)
471 {
472    for (unsigned i = 0; i < 0x10004; i++) {
473       switch (i) {
474       case GL_COLOR_TABLE_SCALE:
475       case GL_COLOR_TABLE_BIAS:
476          break;
477       default:
478          EXPECT_EQ(0, __glColorTableParameterfv_size(i)) << "i = 0x" <<
479             std::setw(4) << std::setfill('0') << std::hex << i;
480       }
481    }
482 }
483 
TEST(ValidEnumSizes,ConvolutionParameterfv)484 TEST(ValidEnumSizes, ConvolutionParameterfv)
485 {
486    EXPECT_EQ(1, __glConvolutionParameterfv_size(GL_CONVOLUTION_BORDER_MODE));
487    EXPECT_EQ(1, __glConvolutionParameterfv_size(GL_CONVOLUTION_BORDER_MODE_EXT));
488    EXPECT_EQ(4, __glConvolutionParameterfv_size(GL_CONVOLUTION_FILTER_SCALE));
489    EXPECT_EQ(4, __glConvolutionParameterfv_size(GL_CONVOLUTION_FILTER_SCALE_EXT));
490    EXPECT_EQ(4, __glConvolutionParameterfv_size(GL_CONVOLUTION_FILTER_BIAS));
491    EXPECT_EQ(4, __glConvolutionParameterfv_size(GL_CONVOLUTION_FILTER_BIAS_EXT));
492    EXPECT_EQ(4, __glConvolutionParameterfv_size(GL_CONVOLUTION_BORDER_COLOR));
493    EXPECT_EQ(4, __glConvolutionParameterfv_size(GL_CONVOLUTION_BORDER_COLOR_HP));
494 }
495 
TEST(InvalidEnumSizes,ConvolutionParameterfv)496 TEST(InvalidEnumSizes, ConvolutionParameterfv)
497 {
498    for (unsigned i = 0; i < 0x10004; i++) {
499       switch (i) {
500       case GL_CONVOLUTION_BORDER_MODE:
501 /*      case GL_CONVOLUTION_BORDER_MODE_EXT:*/
502       case GL_CONVOLUTION_FILTER_SCALE:
503 /*      case GL_CONVOLUTION_FILTER_SCALE_EXT:*/
504       case GL_CONVOLUTION_FILTER_BIAS:
505 /*      case GL_CONVOLUTION_FILTER_BIAS_EXT:*/
506       case GL_CONVOLUTION_BORDER_COLOR:
507 /*      case GL_CONVOLUTION_BORDER_COLOR_HP:*/
508          break;
509       default:
510          EXPECT_EQ(0, __glConvolutionParameterfv_size(i)) << "i = 0x" <<
511             std::setw(4) << std::setfill('0') << std::hex << i;
512       }
513    }
514 }
515 
TEST(ValidEnumSizes,PointParameterfv)516 TEST(ValidEnumSizes, PointParameterfv)
517 {
518    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_SIZE_MIN));
519    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_SIZE_MIN_ARB));
520    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_SIZE_MIN_SGIS));
521    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_SIZE_MAX));
522    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_SIZE_MAX_ARB));
523    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_SIZE_MAX_SGIS));
524    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_FADE_THRESHOLD_SIZE));
525    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_FADE_THRESHOLD_SIZE_ARB));
526    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_FADE_THRESHOLD_SIZE_SGIS));
527    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_SPRITE_R_MODE_NV));
528    EXPECT_EQ(1, __glPointParameterfv_size(GL_POINT_SPRITE_COORD_ORIGIN));
529    EXPECT_EQ(3, __glPointParameterfv_size(GL_POINT_DISTANCE_ATTENUATION));
530    EXPECT_EQ(3, __glPointParameterfv_size(GL_POINT_DISTANCE_ATTENUATION_ARB));
531 }
532 
TEST(InvalidEnumSizes,PointParameterfv)533 TEST(InvalidEnumSizes, PointParameterfv)
534 {
535    for (unsigned i = 0; i < 0x10004; i++) {
536       switch (i) {
537       case GL_POINT_SIZE_MIN:
538 /*      case GL_POINT_SIZE_MIN_ARB:*/
539 /*      case GL_POINT_SIZE_MIN_SGIS:*/
540       case GL_POINT_SIZE_MAX:
541 /*      case GL_POINT_SIZE_MAX_ARB:*/
542 /*      case GL_POINT_SIZE_MAX_SGIS:*/
543       case GL_POINT_FADE_THRESHOLD_SIZE:
544 /*      case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/
545 /*      case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/
546       case GL_POINT_SPRITE_R_MODE_NV:
547       case GL_POINT_SPRITE_COORD_ORIGIN:
548       case GL_POINT_DISTANCE_ATTENUATION:
549 /*      case GL_POINT_DISTANCE_ATTENUATION_ARB:*/
550          break;
551       default:
552          EXPECT_EQ(0, __glPointParameterfv_size(i)) << "i = 0x" <<
553             std::setw(4) << std::setfill('0') << std::hex << i;
554       }
555    }
556 }
557