Coverage for skema/program_analysis/tests/test_wiring_diagnosis.py: 100%

21 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1from skema.program_analysis.gromet_wire_diagnosis import check_wire 

2from skema.gromet.fn import GrometWire 

3 

4 

5def test_correct_wire(): 

6 correct_wire = GrometWire(src=1, tgt=1) 

7 result = check_wire(correct_wire, 1, 1, "wff") 

8 assert not result 

9 

10 correct_wire = GrometWire(src=3, tgt=4) 

11 result = check_wire(correct_wire, 4, 5, "wlc") 

12 assert not result 

13 

14 correct_wire = GrometWire(src=2, tgt=1) 

15 result = check_wire(correct_wire, 2, 1, "wff") 

16 

17def test_wrong_wire(): 

18 wrong_wire = GrometWire(src=0, tgt=-1) 

19 result = check_wire(wrong_wire, 1, 1, "wff") 

20 assert result 

21 

22 wrong_wire = GrometWire(src=20, tgt=2) 

23 result = check_wire(wrong_wire, 19, 2, "wff") 

24 assert result 

25 

26 wrong_wire = GrometWire(src=-1, tgt=2) 

27 result = check_wire(wrong_wire, 1, 1, "wlc") 

28 assert result