Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2
修订版 | fd68262da007587f8f686a4dfac7f578f01f96c9 (tree) |
---|---|
时间 | 2023-11-01 01:40:13 |
作者 | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
BUSY --RPy: Protocol-rendering some test work. Need more work
@@ -10,22 +10,12 @@ | ||
10 | 10 | # CURRENT: The now current test, in TDD phase |
11 | 11 | # TODO: Some test that are needed soon |
12 | 12 | rPY_LAST = \ |
13 | - pytst/aigr/test_0_AIGR.py \ | |
14 | - pytst/writers/RPy/test_1_EventIndexes.py \ | |
15 | - pytst/aigr/test_2a_protocolKind.py \ | |
16 | - pytst/aigr/test_2b_protocol.py \ | |
17 | - pytst/writers/RPy/test_0_templating.py \ | |
18 | - pytst/writers/RPy/test_1_EventIndexes.py \ | |
19 | - pytst/writers/RPy/test_2_ProtocolDataStructures.py \ | |
20 | - pytst/aigr/test_2c_GenericProtocols.py \ | |
21 | - pytst/aigr/test_0_aid.py \ | |
22 | - pytst/TD_AIGR/test_0_base.py \ | |
23 | - pytst/TD_AIGR/test_1_sieve_protocols.py \ | |
13 | + pytst/aigr/test_3_namespaces.py \ | |
14 | + pytst/TD_AIGR/test_2_sieve_NS.py \ | |
24 | 15 | # |
25 | 16 | rPY_CURRENT = \ |
26 | 17 | pytst/writers/RPy/test_3_SieveProtocols.py \ |
27 | - pytst/aigr/test_3_namespaces.py \ | |
28 | - pytst/TD_AIGR/test_2_sieve_NS.py \ | |
18 | + | |
29 | 19 | # |
30 | 20 | CC2CPy_TODO = \ |
31 | 21 | pytst/aigr/test_3_namespaces.py \ |
@@ -40,6 +30,8 @@ | ||
40 | 30 | include Mk/helpful.mk |
41 | 31 | include Mk/mypy.mk |
42 | 32 | |
33 | +GAM: clean_generated current-only diff_TestDoubles | |
34 | + | |
43 | 35 | missing: missing_visitor missing_serialization |
44 | 36 | open: coverage-open mutmut-open |
45 | 37 | remake: veryclean coverage mutmut open |
@@ -4,8 +4,9 @@ | ||
4 | 4 | |
5 | 5 | #### |
6 | 6 | from CC import buildin |
7 | + | |
8 | +#Put the Castle/generated imports here | |
7 | 9 | from CC import base |
8 | - | |
9 | 10 | import SlowStart_1 |
10 | 11 | |
11 | 12 |
@@ -4,10 +4,9 @@ | ||
4 | 4 | |
5 | 5 | #### |
6 | 6 | from CC import buildin |
7 | -from CC import base | |
8 | 7 | |
9 | 8 | #Put the Castle/generated imports here |
10 | - | |
9 | +from CC import base | |
11 | 10 | |
12 | 11 | |
13 | 12 | ## |
@@ -4,8 +4,9 @@ | ||
4 | 4 | |
5 | 5 | #### |
6 | 6 | from CC import buildin |
7 | + | |
8 | +#Put the Castle/generated imports here | |
7 | 9 | from CC import base |
8 | - | |
9 | 10 | import SlowStart |
10 | 11 | |
11 | 12 |
@@ -9,8 +9,6 @@ | ||
9 | 9 | from CC import base |
10 | 10 | |
11 | 11 | |
12 | - | |
13 | - | |
14 | 12 | ## |
15 | 13 | ## EventIndexes (All 2 events of StartSieve) |
16 | 14 | ## |
@@ -3,11 +3,11 @@ | ||
3 | 3 | * ``protocols``: PTH.Sequence[aigr.EventProtocol] |
4 | 4 | #} |
5 | 5 | |
6 | -{%- for proto in protocols %} | |
7 | - {% set p_ns = proto.ns %} | |
8 | - {% if p_ns is not none %} | |
6 | +{%- for proto in protocols -%} | |
7 | + {%- set p_ns = proto.ns -%} | |
8 | + {%- if p_ns is not none -%} | |
9 | 9 | {%- for ns_name in p_ns.all_NS() -%} |
10 | 10 | from CC import {{ ns_name }} #XXX# This works, but is a bit simple |
11 | - {% endfor %} | |
12 | - {% endif %} | |
13 | -{% endfor %} | |
11 | + {%- endfor -%} | |
12 | + {%- endif -%} | |
13 | +{%- endfor -%} |
@@ -17,7 +17,6 @@ | ||
17 | 17 | {% include 'parts/protocol_imports.jinja2' %} |
18 | 18 | {% endblock %} |
19 | 19 | |
20 | - | |
21 | 20 | {% block EventIndexes %} |
22 | 21 | {% for protocol in protocols %} |
23 | 22 | {% set events = protocol.events %} |
@@ -1,8 +1,8 @@ | ||
1 | 1 | # (C) Albert Mietus, 2023. Part of Castle/CCastle project |
2 | 2 | """Test AIGR representation of the TheSieve protocols |
3 | + | |
3 | 4 | See file:///Users/albert/work/DocIdeas,hg/__result/html/CCastle/HACK/DocParts/Design/231016_NS.html |
4 | - (not published yet -- see .../DocParts/Design/231016_NS.rst for source) | |
5 | -""" | |
5 | + (not published yet -- see .../DocParts/Design/231016_NS.rst for source)""" | |
6 | 6 | |
7 | 7 | import pytest |
8 | 8 |
@@ -15,25 +15,26 @@ | ||
15 | 15 | assert ns.name == as_name |
16 | 16 | for n in registered_names: |
17 | 17 | if isinstance(n, (list, tuple)): |
18 | - #This is hardly/not used: be we support `import n[1] as n[0]` | |
18 | + # This is hardly/not used: but .... We support `import n[1] as n[0]` | |
19 | 19 | assert len(n) == 2 |
20 | 20 | name, asName = n[1], n[0] |
21 | 21 | else: |
22 | 22 | name, asName = n, n |
23 | 23 | assert ns.getID(asName).name == name |
24 | 24 | |
25 | -def test_start_sieve(): | |
25 | +def test_slow_start_has_SlowStart(): | |
26 | + ns = namespaces.slow_start | |
27 | + verify_NS(ns, "slow_start", ["SlowStart"]) | |
28 | + | |
29 | +def test_start_sieve_has_StartSieve(): | |
26 | 30 | ns = namespaces.start_sieve |
27 | 31 | verify_NS(ns, "start_sieve", ["StartSieve"]) |
28 | 32 | |
29 | -def test_slow_start(): | |
30 | - ns = namespaces.slow_start | |
31 | - verify_NS(ns, "slow_start", ["SlowStart"]) | |
32 | - | |
33 | -def test_simple_sieve(): | |
33 | +def test_simple_sieve_has_SimpleSieve_and_SpecialiseGeneric(): | |
34 | 34 | ns = namespaces.simple_sieve |
35 | 35 | verify_NS(ns, "simple_sieve", ["SlowStart_1", "SimpleSieve"]) |
36 | 36 | |
37 | + | |
37 | 38 | def test_top(): |
38 | 39 | ns = namespaces.top |
39 | 40 | verify_NS(ns, "top", as_name='TheSieve', registered_names=('start_sieve', 'slow_start', 'simple_sieve')) |
@@ -21,20 +21,18 @@ | ||
21 | 21 | def test_01_StartSieve(generatedProtocol_verifier): |
22 | 22 | generatedProtocol_verifier(aigr_mock=sieve.StartSieve, td=TstDoubles('protocols/StartSieve'), strip_remarker=True) |
23 | 23 | |
24 | - | |
25 | -@pytest.mark.skip("Top one first") | |
26 | -@pytest.mark.xfail(reason="NS support in ``TestDoubles/reference/protocols/*``, not in code") | |
27 | 24 | def test_02_SlowStart(generatedProtocol_verifier): |
28 | - generatedProtocol_verifier(aigr_mock=sieve.SlowStart, td=TstDoubles('protocols/SlowStart')) | |
25 | + generatedProtocol_verifier(aigr_mock=sieve.SlowStart, td=TstDoubles('protocols/SlowStart'), strip_remarker=True) | |
29 | 26 | |
30 | -@pytest.mark.skip("Top one first") | |
31 | -@pytest.mark.xfail(reason="NS support in ``TestDoubles/reference/protocols/*``, not in code") | |
32 | -def test_03a_SlowStart1(generatedProtocol_verifier): | |
33 | - generatedProtocol_verifier(aigr_mock=sieve.SlowStart_1, td=TstDoubles('protocols/SlowStart_1')) | |
27 | +if False: # SlowStart1 and SimpleSieve are in the same NS, so in the same file | |
28 | + def test_03_SlowStart1(generatedProtocol_verifier): | |
29 | + generatedProtocol_verifier(aigr_mock=sieve.SlowStart_1, td=TstDoubles('protocols/SlowStart_1'), strip_remarker=True) | |
34 | 30 | |
35 | -@pytest.mark.skip("Top one first") | |
36 | -@pytest.mark.xfail(reason="NS support in ``TestDoubles/reference/protocols/*``, not in code") | |
37 | -def test_03b_SimpleSieve(generatedProtocol_verifier): | |
38 | - generatedProtocol_verifier(aigr_mock=sieve.SimpleSieve, td=TstDoubles('protocols/SimpleSieve')) | |
31 | + def test_04_SimpleSieve(generatedProtocol_verifier): | |
32 | + generatedProtocol_verifier(aigr_mock=sieve.SimpleSieve, td=TstDoubles('protocols/SimpleSieve'), strip_remarker=True) | |
39 | 33 | |
34 | +@pytest.mark.skip("ToDo: Merge") | |
35 | +def test_03_SimpleSieve_withGeneric(generatedProtocol_verifier): | |
36 | + generatedProtocol_verifier(aigr_mock=(sieve.SlowStart_1, sieve.SimpleSieve), td=TstDoubles('protocols/SimpleSieve'), strip_remarker=True) | |
40 | 37 | |
38 | + assert False, "Not yet done" |