Skip to content

Commit

Permalink
check_B (#11) bug is corrected.
Browse files Browse the repository at this point in the history
  • Loading branch information
barisccolak committed Oct 20, 2023
1 parent 32f573d commit d807f15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
19 changes: 4 additions & 15 deletions testmodule/fileparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def check_A(job_file, group, number, file_name):
)


############################################################################## buggy: if both of them doesn't exist, it still prints the error-
def check_B(job_file, group, number, file_name):
"""Check (JBI-W, 2).
Expand All @@ -71,22 +70,12 @@ def check_B(job_file, group, number, file_name):
file_name : str
Name of the file.
"""
is_allowed_flag = False

for i in job_file.programlines:
if (
i.startswith("SETREG MREG#")
and job_file.foldername == "TWINCAT_KOMMUNIKATION"
):
is_allowed_flag = True

if not is_allowed_flag:
print(
f"{file_name} - {group}{number} [3] :The program command SETREG MREG# should only be allowed when the job is listed under FOLDERNAME TWINCAT_KOMMUNIKATION"
)


############################################################################## buggy: if both of them doesn't exist, it still prints the error-
if i.startswith("SETREG MREG#"):
if not job_file.foldername == "TWINCAT_KOMMUNIKATION":
print(f"{file_name} - {group}{number} [3] :The program command SETREG MREG# should only be allowed when the job is listed under FOLDERNAME TWINCAT_KOMMUNIKATION")
break


def check_C(job_file, group, number, file_name):
Expand Down
3 changes: 2 additions & 1 deletion testmodule/singleinputfile/1test.JBI
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/JOB
//NAME DEMONSTRATOR_A7
///FOLDERNAME DEMONSTRATOR
///FOLDERNAME TWINCAT_KOMMUNIKATIO
//POS
///NPOS 0,0,0,1,0,0
///USER 4
Expand Down Expand Up @@ -72,6 +72,7 @@ GETARG KENNLINIE IARG#(8)
'################################
SET V_weld_offset EXPRESS V_weld * 2
'################################
SETR#
SET Z Z_left
SET Point 0
SET Direction -1
Expand Down

0 comments on commit d807f15

Please # to comment.