test_gles3_builder.py 947 B

1234567891011121314151617181920212223242526272829303132
  1. import json
  2. import pytest
  3. from gles3_builders import GLES3HeaderStruct, build_gles3_header
  4. @pytest.mark.parametrize(
  5. ["shader_files", "builder", "header_struct"],
  6. [
  7. ("gles3/vertex_fragment", build_gles3_header, GLES3HeaderStruct),
  8. ],
  9. indirect=["shader_files"],
  10. )
  11. def test_gles3_builder(shader_files, builder, header_struct):
  12. header = header_struct()
  13. builder(shader_files["path_input"], "drivers/gles3/shader_gles3.h", "GLES3", header_data=header)
  14. with open(shader_files["path_expected_parts"], "r", encoding="utf-8") as f:
  15. expected_parts = json.load(f)
  16. assert expected_parts == header.__dict__
  17. with open(shader_files["path_output"], "r", encoding="utf-8") as f:
  18. actual_output = f.read()
  19. assert actual_output
  20. with open(shader_files["path_expected_full"], "r", encoding="utf-8") as f:
  21. expected_output = f.read()
  22. assert actual_output == expected_output