aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sdp/ao_assertions.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-04-24 22:35:39 -0400
committerRalph Amissah <ralph@amissah.com>2016-04-24 22:35:39 -0400
commit9c14b019a6f695b54a035605e3bb3fc76bf20aa6 (patch)
tree517169ec313d81aca54da3ddcb1f329b7caba695 /lib/sdp/ao_assertions.d
parentstep1 (diff)
Diffstat (limited to 'lib/sdp/ao_assertions.d')
-rw-r--r--lib/sdp/ao_assertions.d221
1 files changed, 0 insertions, 221 deletions
diff --git a/lib/sdp/ao_assertions.d b/lib/sdp/ao_assertions.d
deleted file mode 100644
index 2aa2c1d..0000000
--- a/lib/sdp/ao_assertions.d
+++ /dev/null
@@ -1,221 +0,0 @@
-/+
- assertions
- ao_assertions.d
-+/
-mixin template AssertionsOnMarkupDocumentStructure() {
- auto assertions_doc_structure(string[string] object, uint[string] lv) {
- if (lv["h3"] > 0) {
- assert(lv["h0"] > 0);
- assert(lv["h1"] > 0);
- assert(lv["h2"] > 0);
- assert(lv["h3"] > 0);
- } else if (lv["h2"] > 0) {
- assert(lv["h0"] > 0);
- assert(lv["h1"] > 0);
- assert(lv["h2"] > 0);
- assert(lv["h3"] == 0);
- } else if (lv["h1"] > 0) {
- assert(lv["h0"] > 0);
- assert(lv["h1"] > 0);
- assert(lv["h2"] == 0);
- assert(lv["h3"] == 0);
- } else if (lv["h0"] > 0) {
- assert(lv["h0"] > 0);
- assert(lv["h1"] == 0);
- assert(lv["h2"] == 0);
- assert(lv["h3"] == 0);
- } else {
- assert(lv["h0"] == 0);
- assert(lv["h1"] == 0);
- assert(lv["h2"] == 0);
- assert(lv["h3"] == 0);
- }
- if (lv["h7"] > 0) {
- assert(lv["h4"] > 0);
- assert(lv["h5"] > 0);
- assert(lv["h6"] > 0);
- assert(lv["h7"] > 0);
- } else if (lv["h6"] > 0) {
- assert(lv["h4"] > 0);
- assert(lv["h5"] > 0);
- assert(lv["h6"] > 0);
- assert(lv["h7"] == 0);
- } else if (lv["h5"] > 0) {
- assert(lv["h4"] > 0);
- assert(lv["h5"] > 0);
- assert(lv["h6"] == 0);
- assert(lv["h7"] == 0);
- } else if (lv["h4"] > 0) {
- assert(lv["h4"] > 0);
- assert(lv["h5"] == 0);
- assert(lv["h6"] == 0);
- assert(lv["h7"] == 0);
- } else {
- assert(lv["h4"] == 0);
- assert(lv["h5"] == 0);
- assert(lv["h6"] == 0);
- assert(lv["h7"] == 0);
- }
- if (lv["h0"] == 0) {
- assert(lv["h0"] == 0);
- assert(lv["h1"] == 0);
- assert(lv["h2"] == 0);
- assert(lv["h3"] == 0);
- assert(lv["h4"] == 0);
- assert(lv["h5"] == 0);
- assert(lv["h6"] == 0);
- assert(lv["h7"] == 0);
- }
- if (lv["h1"] == 0) {
- assert(lv["h1"] == 0);
- assert(lv["h2"] == 0);
- assert(lv["h3"] == 0);
- }
- if (lv["h2"] == 0) {
- assert(lv["h2"] == 0);
- assert(lv["h3"] == 0);
- }
- if (lv["h3"] == 0) {
- assert(lv["h3"] == 0);
- }
- if (lv["h4"] == 0) {
- assert(lv["h4"] == 0);
- assert(lv["h5"] == 0);
- assert(lv["h6"] == 0);
- assert(lv["h7"] == 0);
- }
- if (lv["h5"] == 0) {
- assert(lv["h5"] == 0);
- assert(lv["h6"] == 0);
- assert(lv["h7"] == 0);
- }
- if (lv["h6"] == 0) {
- assert(lv["h6"] == 0);
- assert(lv["h7"] == 0);
- }
- if (lv["h6"] == 0) {
- assert(lv["h7"] == 0);
- }
- switch (to!string(object["lev"])) {
- case "A":
- if (lv["h0"]==0) {
- assert(lv["h0"] == 0);
- assert(lv["h1"] == 0);
- assert(lv["h2"] == 0);
- assert(lv["h3"] == 0);
- assert(lv["h4"] == 0);
- assert(lv["h5"] == 0);
- assert(lv["h6"] == 0);
- assert(lv["h7"] == 0);
- } else { // (lv["h0"] >0)
- assert(lv["h0"] == 0,"error should not enter level A a second time");
- }
- break;
- case "B":
- if (lv["h1"]==0) {
- assert(lv["h0"] > 0);
- assert(lv["h1"] == 0); //
- assert(lv["h2"] == 0);
- assert(lv["h3"] == 0);
- } else { // (lv["h1"] >0)
- assert(lv["h0"] > 0);
- assert(lv["h1"] > 0); //
- }
- break;
- case "C":
- if (lv["h2"]==0) {
- assert(lv["h0"] > 0);
- assert(lv["h1"] > 0);
- assert(lv["h2"] == 0); //
- assert(lv["h3"] == 0);
- } else { // (lv["h2"] > 0)
- assert(lv["h0"] > 0);
- assert(lv["h1"] > 0);
- assert(lv["h2"] > 0); //
- }
- break;
- case "D":
- if (lv["h3"]==0) {
- assert(lv["h0"] > 0);
- assert(lv["h1"] > 0);
- assert(lv["h2"] > 0);
- assert(lv["h3"] == 0); //
- } else { // (lv["h3"] >0)
- assert(lv["h0"] > 0);
- assert(lv["h1"] > 0);
- assert(lv["h2"] > 0);
- assert(lv["h3"] > 0);
- }
- break;
- case "1":
- if (lv["h4"]==0) {
- assert(lv["h0"] > 0);
- assert(lv["h4"] == 0); //
- } else { // (lv["h4"] >0)
- assert(lv["h0"] > 0);
- assert(lv["h4"] > 0); //
- }
- break;
- case "2":
- if (lv["h5"]==0) {
- assert(lv["h0"] > 0);
- assert(lv["h4"] > 0);
- assert(lv["h5"] == 0); //
- } else { // (lv["h5"] >0)
- assert(lv["h0"] > 0);
- assert(lv["h4"] > 0);
- assert(lv["h5"] > 0); //
- }
- break;
- case "3":
- if (lv["h6"]==0) {
- assert(lv["h0"] > 0);
- assert(lv["h4"] > 0);
- assert(lv["h5"] > 0);
- assert(lv["h6"] == 0); //
- } else { // (lv["h6"] >0)
- assert(lv["h0"] > 0);
- assert(lv["h4"] > 0);
- assert(lv["h5"] > 0);
- assert(lv["h6"] > 0); //
- }
- break;
- case "4":
- if (lv["h7"]==0) {
- assert(lv["h0"] > 0);
- assert(lv["h4"] > 0);
- assert(lv["h5"] > 0);
- assert(lv["h6"] > 0);
- assert(lv["h7"] == 0); //
- } else { // (lv["h7"] >0)
- assert(lv["h0"] > 0);
- assert(lv["h4"] > 0);
- assert(lv["h5"] > 0);
- assert(lv["h6"] > 0);
- assert(lv["h7"] > 0); //
- }
- break;
- default:
- break;
- }
- }
-}
-mixin template AssertionsOnBlocks() {
- auto assertions_flag_types_block_status_none_or_closed(int[string] flag_type) {
- assert(
- (flag_type["code"] == 0) || (flag_type["code"] == 2),
- "code block status: none or closed");
- assert(
- (flag_type["poem"] == 0) || (flag_type["poem"] == 2),
- "poem status: none or closed");
- assert(
- (flag_type["table"] == 0) || (flag_type["table"] == 2),
- "table status: none or closed");
- assert(
- (flag_type["group"] == 0) || (flag_type["group"] == 2),
- "group block status: none or closed");
- assert(
- (flag_type["block"] == 0) || (flag_type["block"] == 2),
- "block status: none or closed");
- }
-}