2022-06-30 04:14:07 +02:00
|
|
|
import json
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from gles3_builders import build_gles3_header, GLES3HeaderStruct
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
["shader_files", "builder", "header_struct"],
|
|
|
|
[
|
|
|
|
("gles3/vertex_fragment", build_gles3_header, GLES3HeaderStruct),
|
|
|
|
],
|
|
|
|
indirect=["shader_files"],
|
|
|
|
)
|
|
|
|
def test_gles3_builder(shader_files, builder, header_struct):
|
|
|
|
header = header_struct()
|
|
|
|
|
|
|
|
builder(shader_files["path_input"], "drivers/gles3/shader_gles3.h", "GLES3", header_data=header)
|
|
|
|
|
2024-03-24 18:02:56 +01:00
|
|
|
with open(shader_files["path_expected_parts"], "r", encoding="utf-8") as f:
|
2022-06-30 04:14:07 +02:00
|
|
|
expected_parts = json.load(f)
|
|
|
|
assert expected_parts == header.__dict__
|
|
|
|
|
2024-03-24 18:02:56 +01:00
|
|
|
with open(shader_files["path_output"], "r", encoding="utf-8") as f:
|
2022-06-30 04:14:07 +02:00
|
|
|
actual_output = f.read()
|
|
|
|
assert actual_output
|
|
|
|
|
2024-03-24 18:02:56 +01:00
|
|
|
with open(shader_files["path_expected_full"], "r", encoding="utf-8") as f:
|
2022-06-30 04:14:07 +02:00
|
|
|
expected_output = f.read()
|
|
|
|
|
|
|
|
assert actual_output == expected_output
|