forked from heremaps/flatdata
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cpp_generator.py
More file actions
32 lines (25 loc) · 943 Bytes
/
test_cpp_generator.py
File metadata and controls
32 lines (25 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'''
Copyright (c) 2025 HERE Europe B.V.
See the LICENSE file in the root of this project for license details.
'''
import glob
import pytest
from flatdata.generator.generators.cpp import CppGenerator
from .assertions import generate_and_assert_in
from .schemas import schemas_and_expectations
def generate_and_compare(test_case):
with open(test_case[0], 'r') as test_file:
test = test_file.read()
expectations = list()
for file in glob.glob(test_case[1] + '*'):
with open(file, 'r') as expectation_file:
expectations.append(expectation_file.read())
generate_and_assert_in(test, CppGenerator, *expectations)
def get_test_cases():
test_cases = []
for x in schemas_and_expectations(generator='cpp', extension='h'):
test_cases.append(x)
return test_cases
@pytest.mark.parametrize("case", get_test_cases())
def test_against_expectations(case):
generate_and_compare(case)