Commit 16dc07b3 authored by Dylan Baker's avatar Dylan Baker
Browse files

gen_const_builtin_equal_tests.py: use enumerate instead of a flag



This combines the two loops into a single loop using enumerate. This
should be a little faster since we loop over the data only once, and
since it uses enumerate instead of math.

v2: - explicitly name enumerate's start parameter to make it clearer
Signed-off-by: Dylan Baker's avatarDylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Ilia Mirkin's avatarIlia Mirkin <imirkin@alum.mit.edu>
parent 94942651
......@@ -104,21 +104,19 @@ def main():
except OSError:
pass
test_id = 2
for x in test_vectors:
name = "spec/glsl-1.20/execution/built-in-functions/glsl-const-builtin-equal-%02d.shader_test" % test_id
test_id = test_id + 1
for test_id, x in enumerate(test_vectors, start=2):
# make equal tests
name = ("spec/glsl-1.20/execution/built-in-functions/"
"glsl-const-builtin-equal-{0:02d}.shader_test".format(test_id))
print(name)
with open(name, 'w') as f:
f.write(TEMPLATE.render_unicode(
func='equal', input=x[0:2], expected=x[2]))
test_id = 2
for x in test_vectors:
name = "spec/glsl-1.20/execution/built-in-functions/glsl-const-builtin-notEqual-%02d.shader_test" % test_id
test_id = test_id + 1
# make notEqual tests
name = ("spec/glsl-1.20/execution/built-in-functions/"
"glsl-const-builtin-notEqual-{0:02d}.shader_test".format(test_id))
# When generating the notEqual tests, each of the values in the
# expected result vector need to be inverted
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment