diff --git a/crit.js b/crit.js index 00ab9e8..30fb236 100644 --- a/crit.js +++ b/crit.js @@ -170,9 +170,9 @@ function show_rolls(who,d_vars){ var msg=""; var msg_foot=""; var msg_adds=""; - var msg_relance="Relancer ce jet";\'' + return reroll def check_reroll(args): "Check the reroll inline message" - model=""""Relancer ce jet";""" - var=re.compile('" .* ".*\+"') - print(var.search(model)) + errors=0 + model=""""var msg_relance="Relancer ce jet";""" + var=re.compile(' ([a-zA-Z:+_] .*?".*?)(?:\+"|;)') + roll=reroll(args) + + # All theese MUST be in the final version, this test will be a pain + # to maintain since every addentum will be added to it manually + #print (roll) + for e in (var.findall(model)): + if roll.find(e)<0: + errors+=1 + print("Can't find [{}] in the generated roll".format(e)) + + for e in var.findall(roll): + if model.find(e)<0: + errors+=1 + print("The expression [{}] is in the generated values but not the test".format(e)) + + return pErrors(sys._getframe().f_code.co_name,errors) + def check_wrapper(args): "Test the wrapper, only useful internally" - fails=0 + errors=0 s=len(hashedCategories) try: wrapper[-1] - fails+=1 + errors+=1 print("Error: Element -1 shouldn't exist") except: pass @@ -252,12 +276,9 @@ def check_wrapper(args): for i in range(s): if wrapper[ele[0]][i]!=ele.asList()[i] or wrapper[ele[0]][i]!=ele[i]: print("Element {} is not identical in all representation {}!={}".format(i,wrapper[ele[0]][i],ele.asList()[i])) - fails+=1 - if fails: - print("{} errors occured".format(fails)) - else: - print("Wrapper: All test sucessful") - return fails + errors+=1 + + return pErrors(sys._getframe().f_code.co_name,errors) def help(args): "Help, print the following message"