From 318fdc012e78c3413d4dcba6ed269abbcf21d961 Mon Sep 17 00:00:00 2001
From: Kia <kia@special-circumstanc.es>
Date: Mon, 24 Aug 2020 17:34:12 -0600
Subject: [PATCH] random testing works, at least for a fixed length of random
 string.

---
 python_arborist.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/python_arborist.py b/python_arborist.py
index 0f46f30..a1ed179 100644
--- a/python_arborist.py
+++ b/python_arborist.py
@@ -354,8 +354,11 @@ def deserializer(serialized_array, last_idx_written):
             false_element = random.choices(list_of_nonterminals + list_of_terminals)[0]
 
             if (false_element != new_element):
-                print("RANDOM TRIGGERED! EXPECT FALSE RESULT!", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
+                print("RANDOM TRIGGERED! EXPECT FALSE RESULT!")
                 random_triggered = True
+                if(random.randint(0,100) == 0):
+                    print("RANDOM TRIGGERED BUT NOT REPORTED! AHAHAHA XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
+                    random_triggered = False
                 new_element = false_element
 
         new_node = TreeNode(new_element, subnodes_array)
@@ -466,11 +469,13 @@ def do_an_iteration():
 
     print("THE ORIGINAL STRING WAS", [hex_to_name(x) for x in parse_me])
     print("WAS RANDOM TRIGGERED??", random_trig)
-    print("ARE TREES EQUAL???", are_trees_equal(bgen[1], parser_output_tree))
+    tree_equalityy = are_trees_equal(bgen[1], parser_output_tree)
+    print("ARE TREES EQUAL???", tree_equalityy)
+    if (random_trig == tree_equalityy):
+        print("MASSIVE ERROR! MASSIVE ERROR!")
+        exit(1)
 
 
-do_an_iteration()
+for x in range(1024):
+    do_an_iteration()
 
-print("DOING IT A SECOND TIME XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
-
-do_an_iteration()
\ No newline at end of file
-- 
GitLab