• 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

Revision04f1dce1fca35bb7625037eea84b26fff235f1de (tree)
Time2023-10-05 06:01:53
AuthorAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

Added a few atypical cases to the tests, to get coverage

Change Summary

Incremental Difference

diff -r fb3240ad99ab -r 04f1dce1fca3 pytst/aigr/test_2b_protocol.py
--- a/pytst/aigr/test_2b_protocol.py Wed Oct 04 22:31:58 2023 +0200
+++ b/pytst/aigr/test_2b_protocol.py Wed Oct 04 23:01:53 2023 +0200
@@ -13,6 +13,10 @@
1313 return EventProtocol("EMPTY", events=[], based_on=None)
1414
1515 @pytest.fixture
16+def emptyProtocol_baseNotSet():
17+ return Protocol("VeryEmpty", kind=ProtocolKind.Unknown)
18+
19+@pytest.fixture
1620 def anEvent():
1721 return Event("input", typedParameters=[TypedParameter(name='event', type=int)])
1822
@@ -27,10 +31,14 @@
2731 assert simpleSieve.kind == ProtocolKind.Event
2832
2933
30-def test_2_based_onRoot(emptyProtocol):
34+def test_2a_based_onRoot(emptyProtocol):
3135 import castle.aigr.protocols
3236 emptyProtocol.based_on is castle.aigr.protocols._RootProtocol
3337
38+def test_2b_based_onRoot_notSet(emptyProtocol_baseNotSet):
39+ import castle.aigr.protocols
40+ emptyProtocol_baseNotSet.based_on is castle.aigr.protocols._RootProtocol
41+
3442
3543 def test_3a_eventIndex_empty(emptyProtocol, anEvent):
3644 assert emptyProtocol._noEvents() == 0
diff -r fb3240ad99ab -r 04f1dce1fca3 pytst/aigr/test_2c_GenericProtocols.py
--- a/pytst/aigr/test_2c_GenericProtocols.py Wed Oct 04 22:31:58 2023 +0200
+++ b/pytst/aigr/test_2c_GenericProtocols.py Wed Oct 04 23:01:53 2023 +0200
@@ -65,16 +65,20 @@
6565 def sub_b(base):
6666 return EventProtocol("Sub_b", events=[], based_on=ProtocolWrapper(based_on=base, arguments=(Argument(value=1),)))
6767
68+@pytest.fixture
69+def sub_strange(base):
70+ return EventProtocol("SubStrange", events=[], based_on=ProtocolWrapper(name="Strange", kind=42,
71+ based_on=base, arguments=(Argument(value=1),)))
72+
6873 def assert_GP_kind(base, sub):
6974 assert sub.kind == base.kind
7075 assert sub.based_on.kind == base.kind
7176 assert sub.based_on.based_on is base
7277
73-
7478 def test_GenericProtocol_kind_a(base, sub_a):
7579 assert_GP_kind(base, sub_a)
7680
77-def test_GenericProtocol_kind_a(base, sub_b):
81+def test_GenericProtocol_kind_b(base, sub_b):
7882 assert_GP_kind(base, sub_b)
7983
8084
@@ -82,9 +86,15 @@
8286 assert "Wrapper" in sub.based_on.name
8387 assert "Base" in sub.based_on.name
8488
85-def test_GenericProtocol_name(base, sub_a):
89+def test_GenericProtocol_name_a(base, sub_a):
8690 assert_GP_name(base, sub_a)
87- assert "queue_max" in sub.based_on.name
91+ assert "queue_max" in sub_a.based_on.name # the argument-name is only in the (a) version
8892
89-def test_GenericProtocol_name(base, sub_b):
93+def test_GenericProtocol_name_b(base, sub_b):
9094 assert_GP_name(base, sub_b)
95+ assert "queue_max" not in sub_b.based_on.name # the argument-name is only in the (a) version
96+
97+def test_strange(sub_strange):
98+ """This is (very) atypical use -- but it helps to get coverage"""
99+ assert sub_strange.based_on.name == "Strange"
100+ assert sub_strange.based_on.kind == 42, "When we set a strange kind-number it should be stored"