- with open(filename, "r") as chk:
- text = chk.read()
- loc_coverage(locations, text)
- arb_coverage(arb_msgs, text)
- obj_coverage(objects, text)
- hint_coverage(hints, text)
- threshold_coverage(classes, text)
- threshold_coverage(turn_thresholds, text)
- obit_coverage(obituaries, text)
- specials_actions_coverage(actions, text)
- specials_actions_coverage(specials, text)
-
- report["locations"]["total"] = len(locations) * 2
- report["locations"]["html"] = HTML_CATEGORY_TABLE_HEADER_3_FIELDS.format("Location ID", "long", "short")
- locations.sort()
- for locouter in locations:
- locname = locouter[0]
- loc = locouter[1]
- if loc["description"]["long"] != True:
- long_success = "uncovered"
- else:
- long_success = "covered"
- report["locations"]["covered"] += 1
-
- if loc["description"]["short"] != True:
- short_success = "uncovered"
- else:
- short_success = "covered"
- report["locations"]["covered"] += 1
-
- report["locations"]["html"] += HTML_CATEGORY_ROW_3_FIELDS.format(locname, long_success, short_success)
-
- arb_msgs.sort()
- report["arbitrary_messages"]["total"] = len(arb_msgs)
- report["arbitrary_messages"]["html"] = HTML_CATEGORY_TABLE_HEADER_2_FIELDS.format("Arbitrary Message ID", "covered")
- for name, msg in arb_msgs:
- if msg != True:
- success = "uncovered"
- else:
- success = "covered"
- report["arbitrary_messages"]["covered"] += 1
- report["arbitrary_messages"]["html"] += HTML_CATEGORY_ROW_2_FIELDS.format(name, success)
-
- objects.sort()
- report["objects"]["html"] = HTML_CATEGORY_TABLE_HEADER_2_FIELDS.format("Object ID", "covered")
- for (obj_name, obj) in objects:
- if obj["descriptions"]:
- for j, desc in enumerate(obj["descriptions"]):
- report["objects"]["total"] += 1
- if desc != True:
- success = "uncovered"
- else:
- success = "covered"
- report["objects"]["covered"] += 1
- report["objects"]["html"] += HTML_CATEGORY_ROW_2_FIELDS.format("%s[%d]" % (obj_name, j), success)
-
- hints.sort()
- report["hints"]["total"] = len(hints) * 2
- report["hints"]["html"] = HTML_CATEGORY_TABLE_HEADER_3_FIELDS.format("Hint ID", "question", "hint")
- for i, hint in enumerate(hints):
- hintname = hint["hint"]["name"]
- if hint["hint"]["question"] != True:
- question_success = "uncovered"
- else:
- question_success = "covered"
- report["hints"]["covered"] += 1
- if hint["hint"]["hint"] != True:
- hint_success = "uncovered"
- else:
- hint_success = "covered"
- report["hints"]["covered"] += 1
- report["hints"]["html"] += HTML_CATEGORY_ROW_3_FIELDS.format(name, question_success, hint_success)
-
- report["classes"]["total"] = len(classes)
- report["classes"]["html"] = HTML_CATEGORY_TABLE_HEADER_2_FIELDS.format("Adventurer Class #", "covered")
- for name, msg in enumerate(classes):
- if msg["message"] != True:
- success = "uncovered"
- else:
- success = "covered"
- report["classes"]["covered"] += 1
- report["classes"]["html"] += HTML_CATEGORY_ROW_2_FIELDS.format(msg["threshold"], success)
-
- report["turn_thresholds"]["total"] = len(turn_thresholds)
- report["turn_thresholds"]["html"] = HTML_CATEGORY_TABLE_HEADER_2_FIELDS.format("Turn Threshold", "covered")
- for name, msg in enumerate(turn_thresholds):
- if msg["message"] != True:
- success = "uncovered"
- else:
- success = "covered"
- report["turn_thresholds"]["covered"] += 1
- report["turn_thresholds"]["html"] += HTML_CATEGORY_ROW_2_FIELDS.format(msg["threshold"], success)
-
- report["obituaries"]["total"] = len(obituaries) * 2
- report["obituaries"]["html"] = HTML_CATEGORY_TABLE_HEADER_3_FIELDS.format("Obituary #", "query", "yes_response")
- for i, obit in enumerate(obituaries):
- if obit["query"] != True:
- query_success = "uncovered"
- else:
- query_success = "covered"
- report["obituaries"]["covered"] += 1
- if obit["yes_response"] != True:
- obit_success = "uncovered"
- else:
- obit_success = "covered"
- report["obituaries"]["covered"] += 1
- report["obituaries"]["html"] += HTML_CATEGORY_ROW_3_FIELDS.format(i, query_success, obit_success)
-
- actions.sort()
- report["actions"]["total"] = len(actions)
- report["actions"]["html"] = HTML_CATEGORY_TABLE_HEADER_2_FIELDS.format("Action ID", "covered")
- for name, action in actions:
- if action["message"] != True:
- success = "uncovered"
- else:
- success = "covered"
- report["actions"]["covered"] += 1
- report["actions"]["html"] += HTML_CATEGORY_ROW_2_FIELDS.format(name, success)
-
- report["specials"]["total"] = len(specials)
- report["specials"]["html"] = HTML_CATEGORY_TABLE_HEADER_2_FIELDS.format("Special ID", "covered")
- for name, special in specials:
- if special["message"] != True:
- success = "uncovered"
- else:
- success = "covered"
- report["specials"]["covered"] += 1
- report["specials"]["html"] += HTML_CATEGORY_ROW_2_FIELDS.format(name, success)
-
- # calculate percentages for each catagory and HTML for category tables