[Piglit] [PATCH 22/45] gen_shader_bit_encoding_tests.py: cleanup remaining style issues

Dylan Baker baker.dylan.c at gmail.com
Wed Nov 12 15:46:04 PST 2014


Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 generated_tests/gen_shader_bit_encoding_tests.py | 32 +++++++++++++-----------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/generated_tests/gen_shader_bit_encoding_tests.py b/generated_tests/gen_shader_bit_encoding_tests.py
index aaf0863..4808c6f 100644
--- a/generated_tests/gen_shader_bit_encoding_tests.py
+++ b/generated_tests/gen_shader_bit_encoding_tests.py
@@ -60,16 +60,16 @@ Functions = collections.namedtuple(
 # shader_runner [test] sections. Don't test NaN, since it has many
 # representations. Don't test subnormal values, since hardware might
 # flush them to zero.
-test_data = {
+TEST_DATA = {
     # Interesting floating-point inputs
     'mixed':                        (2.0, 9.5, -4.5, -25.0),
-    '0.0':                          vec4( 0.0), # int 0
+    '0.0':                          vec4(0.0), # int 0
     '-0.0':                         vec4(-0.0), # INT_MIN
-    '1.0':                          vec4( 1.0),
+    '1.0':                          vec4(1.0),
     '-1.0':                         vec4(-1.0),
-    'normalized smallest':          vec4( 1.1754944e-38),
+    'normalized smallest':          vec4(1.1754944e-38),
     'normalized smallest negative': vec4(-1.1754944e-38),
-    'normalized largest':           vec4( 3.4028235e+38),
+    'normalized largest':           vec4(3.4028235e+38),
     'normalized largest negative':  vec4(-3.4028235e+38)
 }
 
@@ -78,7 +78,7 @@ test_data = {
 # out_func: Function to convert floating-point data in test_data (above) into
 #           output (expected) data to pass the shader.
 
-funcs = {
+FUNCS = {
     ('floatBitsToInt', Functions(lambda x: x, floatbitstoint, 'vec4', 'ivec4')),
     ('floatBitsToUint', Functions(lambda x: x, floatbitstouint, 'vec4',
                                   'uvec4')),
@@ -88,14 +88,14 @@ funcs = {
                                   'vec4'))
 }
 
-modifier_funcs = {
+MODIFIER_FUNCS = {
     ('', lambda x: x),
     ('abs', abs),
     ('neg', neg),
     ('neg_abs', lambda x: neg(abs(x))),
 }
 
-requirements = {
+REQUIREMENTS = {
     'ARB_shader_bit_encoding': {
         'version': '1.30',
         'extension': 'GL_ARB_shader_bit_encoding'
@@ -113,15 +113,19 @@ requirements = {
 
 def main():
     """main function."""
-    for api, requirement in requirements.iteritems():
-        for func, attrib in funcs:
+    for api, requirement in REQUIREMENTS.iteritems():
+        for func, attrib in FUNCS:
             for execution_stage in ('vs', 'fs'):
-                for in_modifier_func, modifier_func in modifier_funcs:
-                    # Modifying the sign of an unsigned number doesn't make sense.
+                for in_modifier_func, modifier_func in MODIFIER_FUNCS:
+                    # Modifying the sign of an unsigned number doesn't make
+                    # sense.
                     if func == 'uintBitsToFloat' and in_modifier_func != '':
                         continue
 
-                    modifier_name = '-' + in_modifier_func if in_modifier_func != '' else ''
+                    modifier_name = in_modifier_func
+                    if in_modifier_func != '':
+                        modifier_name = '-{}'.format(in_modifier_func)
+
                     filename = os.path.join(
                         'spec',
                         api.lower(),
@@ -149,7 +153,7 @@ def main():
                             funcs=attrib,
                             modifier_func=modifier_func,
                             in_modifier_func=in_modifier_func,
-                            test_data=test_data))
+                            test_data=TEST_DATA))
 
 
 if __name__ == '__main__':
-- 
2.1.3



More information about the Piglit mailing list