diff --git a/validity_check.py b/validity_check.py new file mode 100644 index 0000000000000000000000000000000000000000..a4516f2fc641b725403d6b5d072050a8cfa0b6ea --- /dev/null +++ b/validity_check.py @@ -0,0 +1,33 @@ +import csv +import sys + +if __name__ == "__main__": + + modified_lines = sys.argv[1] + author = sys.argv[2] + modifs = modified_lines.split('\n') + + if len(modifs) != 2: + print("You modify wrong number of lines !") + exit(1) + + if author not in modifs[0] and (author not in modifs[1]) : + print("You modify the line of another student !\n") + exit(1) + + curr_line = modifs[1].split(',') + + if len(curr_line) != 4: + print('You broke file format by suppressing/adding "," !\n') + exit(1) + + prev_line = modifs[1].split(',') + modifs[0][0]=' ' + modifs[0][1]=' ' + + for i in range(modifs[0]): + if i<3 and prev_line[i] != curr_line[i] : + print('You modify your data !\n') + exit(1) + if(curr_line[4]) !='VU' or (curr_line[4]) !=' VU' or (curr_line[4]) !='VU ': + print('You have to write "VU" in the last column !\n')