• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2


Commit MetaInfo

修订版fd68262da007587f8f686a4dfac7f578f01f96c9 (tree)
时间2023-11-01 01:40:13
作者Albert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

BUSY --RPy: Protocol-rendering some test work. Need more work

更改概述

差异

diff -r 5d6a8e06035c -r fd68262da007 Makefile
--- a/Makefile Tue Oct 31 14:29:52 2023 +0100
+++ b/Makefile Tue Oct 31 17:40:13 2023 +0100
@@ -10,22 +10,12 @@
1010 # CURRENT: The now current test, in TDD phase
1111 # TODO: Some test that are needed soon
1212 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 \
2415 #
2516 rPY_CURRENT = \
2617 pytst/writers/RPy/test_3_SieveProtocols.py \
27- pytst/aigr/test_3_namespaces.py \
28- pytst/TD_AIGR/test_2_sieve_NS.py \
18+
2919 #
3020 CC2CPy_TODO = \
3121 pytst/aigr/test_3_namespaces.py \
@@ -40,6 +30,8 @@
4030 include Mk/helpful.mk
4131 include Mk/mypy.mk
4232
33+GAM: clean_generated current-only diff_TestDoubles
34+
4335 missing: missing_visitor missing_serialization
4436 open: coverage-open mutmut-open
4537 remake: veryclean coverage mutmut open
diff -r 5d6a8e06035c -r fd68262da007 TestDoubles/reference/protocols/SimpleSieve.rpy
--- a/TestDoubles/reference/protocols/SimpleSieve.rpy Tue Oct 31 14:29:52 2023 +0100
+++ b/TestDoubles/reference/protocols/SimpleSieve.rpy Tue Oct 31 17:40:13 2023 +0100
@@ -4,8 +4,9 @@
44
55 ####
66 from CC import buildin
7+
8+#Put the Castle/generated imports here
79 from CC import base
8-
910 import SlowStart_1
1011
1112
diff -r 5d6a8e06035c -r fd68262da007 TestDoubles/reference/protocols/SlowStart.rpy
--- a/TestDoubles/reference/protocols/SlowStart.rpy Tue Oct 31 14:29:52 2023 +0100
+++ b/TestDoubles/reference/protocols/SlowStart.rpy Tue Oct 31 17:40:13 2023 +0100
@@ -4,10 +4,9 @@
44
55 ####
66 from CC import buildin
7-from CC import base
87
98 #Put the Castle/generated imports here
10-
9+from CC import base
1110
1211
1312 ##
diff -r 5d6a8e06035c -r fd68262da007 TestDoubles/reference/protocols/SlowStart_1.rpy
--- a/TestDoubles/reference/protocols/SlowStart_1.rpy Tue Oct 31 14:29:52 2023 +0100
+++ b/TestDoubles/reference/protocols/SlowStart_1.rpy Tue Oct 31 17:40:13 2023 +0100
@@ -4,8 +4,9 @@
44
55 ####
66 from CC import buildin
7+
8+#Put the Castle/generated imports here
79 from CC import base
8-
910 import SlowStart
1011
1112
diff -r 5d6a8e06035c -r fd68262da007 TestDoubles/reference/protocols/StartSieve.rpy
--- a/TestDoubles/reference/protocols/StartSieve.rpy Tue Oct 31 14:29:52 2023 +0100
+++ b/TestDoubles/reference/protocols/StartSieve.rpy Tue Oct 31 17:40:13 2023 +0100
@@ -9,8 +9,6 @@
99 from CC import base
1010
1111
12-
13-
1412 ##
1513 ## EventIndexes (All 2 events of StartSieve)
1614 ##
diff -r 5d6a8e06035c -r fd68262da007 castle/writers/RPy/templates/parts/protocol_imports.jinja2
--- a/castle/writers/RPy/templates/parts/protocol_imports.jinja2 Tue Oct 31 14:29:52 2023 +0100
+++ b/castle/writers/RPy/templates/parts/protocol_imports.jinja2 Tue Oct 31 17:40:13 2023 +0100
@@ -3,11 +3,11 @@
33 * ``protocols``: PTH.Sequence[aigr.EventProtocol]
44 #}
55
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 -%}
99 {%- for ns_name in p_ns.all_NS() -%}
1010 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 -%}
diff -r 5d6a8e06035c -r fd68262da007 castle/writers/RPy/templates/protocol.jinja2
--- a/castle/writers/RPy/templates/protocol.jinja2 Tue Oct 31 14:29:52 2023 +0100
+++ b/castle/writers/RPy/templates/protocol.jinja2 Tue Oct 31 17:40:13 2023 +0100
@@ -17,7 +17,6 @@
1717 {% include 'parts/protocol_imports.jinja2' %}
1818 {% endblock %}
1919
20-
2120 {% block EventIndexes %}
2221 {% for protocol in protocols %}
2322 {% set events = protocol.events %}
diff -r 5d6a8e06035c -r fd68262da007 pytst/TD_AIGR/test_2_sieve_NS.py
--- a/pytst/TD_AIGR/test_2_sieve_NS.py Tue Oct 31 14:29:52 2023 +0100
+++ b/pytst/TD_AIGR/test_2_sieve_NS.py Tue Oct 31 17:40:13 2023 +0100
@@ -1,8 +1,8 @@
11 # (C) Albert Mietus, 2023. Part of Castle/CCastle project
22 """Test AIGR representation of the TheSieve protocols
3+
34 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)"""
66
77 import pytest
88
@@ -15,25 +15,26 @@
1515 assert ns.name == as_name
1616 for n in registered_names:
1717 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]`
1919 assert len(n) == 2
2020 name, asName = n[1], n[0]
2121 else:
2222 name, asName = n, n
2323 assert ns.getID(asName).name == name
2424
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():
2630 ns = namespaces.start_sieve
2731 verify_NS(ns, "start_sieve", ["StartSieve"])
2832
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():
3434 ns = namespaces.simple_sieve
3535 verify_NS(ns, "simple_sieve", ["SlowStart_1", "SimpleSieve"])
3636
37+
3738 def test_top():
3839 ns = namespaces.top
3940 verify_NS(ns, "top", as_name='TheSieve', registered_names=('start_sieve', 'slow_start', 'simple_sieve'))
diff -r 5d6a8e06035c -r fd68262da007 pytst/writers/RPy/test_3_SieveProtocols.py
--- a/pytst/writers/RPy/test_3_SieveProtocols.py Tue Oct 31 14:29:52 2023 +0100
+++ b/pytst/writers/RPy/test_3_SieveProtocols.py Tue Oct 31 17:40:13 2023 +0100
@@ -21,20 +21,18 @@
2121 def test_01_StartSieve(generatedProtocol_verifier):
2222 generatedProtocol_verifier(aigr_mock=sieve.StartSieve, td=TstDoubles('protocols/StartSieve'), strip_remarker=True)
2323
24-
25-@pytest.mark.skip("Top one first")
26-@pytest.mark.xfail(reason="NS support in ``TestDoubles/reference/protocols/*``, not in code")
2724 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)
2926
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)
3430
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)
3933
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)
4037
38+ assert False, "Not yet done"