diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..8e059f8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "csvfile" + ] +} \ No newline at end of file diff --git a/TaskB00/run.py b/TaskB00/run.py index 92f967e..61b68ff 100644 --- a/TaskB00/run.py +++ b/TaskB00/run.py @@ -3,7 +3,6 @@ import csv from numpy import append -print(sys.argv) if len(sys.argv) == 1: print("Default arguments parsed") sys.argv.append("fsa_description.arg") @@ -23,19 +22,26 @@ with open(sys.argv[1], "r", newline="", encoding="utf8") as csvfile: with open(sys.argv[2], "r", newline="", encoding="utf8") as csvfile: filereader = csv.reader(csvfile, delimiter="\t", quotechar="|") - test1_in = list(filereader) + test_in = list(filereader) with open(sys.argv[3], "r", newline="", encoding="utf8") as csvfile: filereader = csv.reader(csvfile, delimiter="\t", quotechar="|") - test1_out = list(filereader) + test_out = list(filereader) -for word in test1_in: +for i, word in enumerate(test_in): current_state = 0 if len(word) != 0: for letter in word[0]: current_state = fsa_description_map[(current_state, letter)] + + print(str(i + 1) + "\t", end="") if current_state == accepting_state: - print("YES") + print("YES\t", end="") + if "YES" != test_out[i][0]: + print(" ERROR", end="") else: - print("NO") + print("NO", end="") + if "NO" != test_out[i][0]: + print(" ERROR", end="") + print()