Skip to content

Commit c4962ca

Browse files
author
Sylvain MARIE
committed
Added test for issue 76
1 parent e67c173 commit c4962ca

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import pytest
2+
import pytest_cases
3+
4+
doubles = [0.0, -1.0, 1.0]
5+
char_strings = ['"s"', '"_"']
6+
c_identifiers = ['_', '_c']
7+
8+
9+
class DummyClass(object):
10+
def __init__(self, *args, **kwargs):
11+
self.args = args
12+
13+
14+
@pytest_cases.fixture_plus()
15+
@pytest.mark.parametrize('double', doubles)
16+
@pytest.mark.parametrize('char_string', char_strings)
17+
def value_table_description(double, char_string):
18+
return '{} {}'.format(double, char_string), DummyClass(double, char_string)
19+
20+
21+
@pytest_cases.fixture_plus()
22+
@pytest.mark.parametrize('value_table_name', c_identifiers)
23+
@pytest.mark.parametrize('value_descriptions_count', [1, 2])
24+
@pytest_cases.parametrize_plus('value_description_0', [pytest_cases.fixture_ref('value_table_description')])
25+
@pytest_cases.parametrize_plus('value_description_1', [pytest_cases.fixture_ref('value_table_description')])
26+
def value_table(value_table_name, value_descriptions_count, value_description_0, value_description_1):
27+
value_description_0_string, value_description_0_value = value_description_0
28+
value_description_1_string, value_description_1_value = value_description_1
29+
value_descriptions_string = [value_description_0_string, value_description_1_string][:value_descriptions_count]
30+
value_descriptions_value = [value_description_0_value, value_description_1_value][:value_descriptions_count]
31+
return ('VAL_TABLE_ {} {} ;'.format(value_table_name, ' '.join(value_descriptions_string)),
32+
DummyClass(value_table_name, value_descriptions_value))
33+
34+
35+
@pytest_cases.fixture_plus()
36+
@pytest.mark.parametrize('value_tables_count', [1, 2])
37+
@pytest_cases.parametrize_plus('value_table_0', [pytest_cases.fixture_ref('value_table')])
38+
@pytest_cases.parametrize_plus('value_table_1', [pytest_cases.fixture_ref('value_table')])
39+
def value_tables(value_tables_count, value_table_0, value_table_1):
40+
value_table_0_string, value_table_0_value = value_table_0
41+
value_table_1_string, value_table_1_value = value_table_1
42+
value_tables_string = '\n'.join([value_table_0_string, value_table_1_string][:value_tables_count])
43+
value_tables_value = [value_table_0_value, value_table_1_value][:value_tables_count]
44+
return value_tables_string, DummyClass(value_tables_value)
45+
46+
47+
@pytest_cases.parametrize_plus('vts', [pytest_cases.fixture_ref('value_tables')])
48+
def test_value_tables_node(vts):
49+
# value_table_string, value_table_value = vts
50+
# p = DummyClass(value_table_string)
51+
# assert isinstance(p.ast.value_tables, list)
52+
# assert p.ast.value_tables[0] == value_table_value
53+
pass
54+
55+
56+
def test_synthesis(module_results_dct):
57+
assert len(module_results_dct) == len([1, 2]) * len(c_identifiers) * len([1, 2]) * len(char_strings) * len(doubles)

0 commit comments

Comments
 (0)