#!/usr/bin/env python # Copyright (c) 2019 The Khronos Group Inc. # Use of this source code is governed by an MIT-style license that can be # found in the LICENSE.txt file. """ Generator for shaderoperator* tests. This file needs to be run in its folder. """ import sys _DO_NOT_EDIT_WARNING = """ """ _HTML_TEMPLATE = """ WebGL Shader Operator Conformance Tests
""" _GROUPS = [ 'unary_operator_00', 'unary_operator_01', 'unary_operator_02', 'binary_operator_00', 'binary_operator_01', 'binary_operator_02', 'binary_operator_03', 'binary_operator_04', 'binary_operator_05', 'binary_operator_06', 'binary_operator_07', 'binary_operator_08', 'binary_operator_09', 'binary_operator_10', 'binary_operator_11', 'binary_operator_12', 'binary_operator_13', 'binary_operator_14', 'binary_operator_15', 'angle_and_trigonometry_00', 'angle_and_trigonometry_01', 'angle_and_trigonometry_02', 'angle_and_trigonometry_03', 'exponential', 'common_functions_00', 'common_functions_01', 'common_functions_02', 'common_functions_03', 'common_functions_04', 'common_functions_05', 'common_functions_06', 'geometric', 'float_compare', 'int_compare', 'bool_compare', 'selection', 'sequence', ] def GenerateFilename(group): """Generate test filename.""" filename = group filename += ".html" return filename def WriteTest(filename, start, end): """Write one test.""" file = open(filename, "wb") file.write(_DO_NOT_EDIT_WARNING) file.write(_HTML_TEMPLATE % { 'start': start, 'end': end }) file.close def GenerateTests(): """Generate all tests.""" filelist = [] for ii in range(len(_GROUPS)): filename = GenerateFilename(_GROUPS[ii]) filelist.append(filename) WriteTest(filename, ii, ii + 1) return filelist def GenerateTestList(filelist): file = open("00_test_list.txt", "wb") file.write('\n'.join(filelist)) file.close def main(argv): """This is the main function.""" filelist = GenerateTests() GenerateTestList(filelist) if __name__ == '__main__': sys.exit(main(sys.argv[1:]))