• R/O
  • SSH

Commit

Tags
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

Revisãoee2503fecb73cd85c90558e78a5f0e8b572ca7d0 (tree)
Hora2023-10-03 19:31:12
AutorAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Mensagem de Log

Refactored pytst on protocol file with generatedProtocol_verifier

Mudança Sumário

Diff

diff -r 6525f57affe6 -r ee2503fecb73 Makefile
--- a/Makefile Tue Oct 03 11:26:50 2023 +0200
+++ b/Makefile Tue Oct 03 12:31:12 2023 +0200
@@ -18,10 +18,9 @@
1818 #
1919 rPY_CURRENT = \
2020 pytst/writers/RPy/test_2_ProtocolDataStructures.py \
21-
21+ pytst/writers/RPy/test_99_SieveMoats.py \
2222 #
2323 CC2CPy_TODO = \
24- pytst/writers/RPy/test_99_SieveMoats.py \
2524 pytst/writers/RPy/test_999.py \
2625 #
2726
diff -r 6525f57affe6 -r ee2503fecb73 pytst/writers/RPy/test_99_SieveMoats.py
--- a/pytst/writers/RPy/test_99_SieveMoats.py Tue Oct 03 11:26:50 2023 +0200
+++ b/pytst/writers/RPy/test_99_SieveMoats.py Tue Oct 03 12:31:12 2023 +0200
@@ -8,22 +8,25 @@
88 from TestDoubles.AIGR.protocols import Sieve
99
1010 from . import T_Protocol, TstDoubles
11+from castle.writers import RPy
1112
1213
13-def test_01_StartSieve(T_Protocol):
14- td = TstDoubles('protocols/StartSieve')
15- out = T_Protocol.render(protocols=[Sieve.StartSieve,])
16- with open(td.gen_file, 'w') as f:
17- f.write(out)
18- assert filecmp.cmp(td.gen_file, td.ref_file), f"The generated file ({td.gen_file}) and the reference ({td.ref_file}) are not the same"
14+@pytest.fixture
15+def generatedProtocol_verifier():
16+ def file_matcher(aigr_dummy, td):
17+ template = RPy.Template("protocol.jinja2")
18+ out = template.render(protocols=(aigr_dummy,))
19+ with open(td.gen_file, 'w') as f:
20+ f.write(out)
21+ assert filecmp.cmp(td.gen_file, td.ref_file), f"The generated file ({td.gen_file}) and the reference ({td.ref_file}) are not the same"
22+ return file_matcher
1923
2024
21-def test_03_SlowStart(T_Protocol):
22- td = TstDoubles('protocols/SlowStart')
23- out = T_Protocol.render(protocols=[Sieve.SlowStart,])
24- with open(td.gen_file, 'w') as f:
25- f.write(out)
26- assert filecmp.cmp(td.gen_file, td.ref_file), f"The generated file ({td.gen_file}) and the reference ({td.ref_file}) are not the same"
25+def test_01_StartSieve(generatedProtocol_verifier):
26+ generatedProtocol_verifier(aigr_dummy=Sieve.StartSieve, td=TstDoubles('protocols/StartSieve'))
27+
28+def test_02_SlowStart(generatedProtocol_verifier):
29+ generatedProtocol_verifier(aigr_dummy=Sieve.SlowStart, td=TstDoubles('protocols/SlowStart'))
2730
2831
2932