aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/relooper/test.cpp31
-rw-r--r--src/relooper/test.txt18
2 files changed, 49 insertions, 0 deletions
diff --git a/src/relooper/test.cpp b/src/relooper/test.cpp
index 78de9e64..9f3ddceb 100644
--- a/src/relooper/test.cpp
+++ b/src/relooper/test.cpp
@@ -404,5 +404,36 @@ int main() {
puts(r.GetOutputBuffer());
}
+
+ if (1) {
+ Relooper::MakeOutputBuffer(10);
+
+ printf("\n\n-- If chain (optimized, lead to complex) --\n\n");
+
+ Block *b_a = new Block("// block A\n", NULL);
+ Block *b_b = new Block("// block B\n", NULL);
+ Block *b_c = new Block("// block C\n", NULL);
+ Block *b_d = new Block("// block D\n", NULL);
+
+ b_a->AddBranchTo(b_b, "a == 10", NULL);
+ b_a->AddBranchTo(b_d, NULL, NULL);
+
+ b_b->AddBranchTo(b_c, "b == 10", NULL);
+ b_b->AddBranchTo(b_d, NULL, NULL);
+
+ b_c->AddBranchTo(b_c, "loop", NULL);
+ b_c->AddBranchTo(b_d, NULL, NULL);
+
+ Relooper r;
+ r.AddBlock(b_a);
+ r.AddBlock(b_b);
+ r.AddBlock(b_c);
+ r.AddBlock(b_d);
+
+ r.Calculate(b_a);
+ r.Render();
+
+ puts(r.GetOutputBuffer());
+ }
}
diff --git a/src/relooper/test.txt b/src/relooper/test.txt
index 7d79e037..d53aeeb1 100644
--- a/src/relooper/test.txt
+++ b/src/relooper/test.txt
@@ -399,3 +399,21 @@
}
// block E
+
+
+-- If chain (optimized, lead to complex) --
+
+ // block A
+ if (a == 10) {
+ // block B
+ if (b == 10) {
+ while(1) {
+ // block C
+ if (!(loop)) {
+ break;
+ }
+ }
+ }
+ }
+ // block D
+