aboutsummaryrefslogtreecommitdiff
path: root/src/relooper/test.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-15 15:16:57 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-03-17 17:56:17 -0700
commitdbb60d034c77c65aee16bc971fb0957838ca31d7 (patch)
tree1e7178605def46e2f12d0aef63142ebce29b9e70 /src/relooper/test.cpp
parentb0794537c311ff38bd6e9e87e173861c88303b24 (diff)
add another if testcase in relooper
Diffstat (limited to 'src/relooper/test.cpp')
-rw-r--r--src/relooper/test.cpp31
1 files changed, 31 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());
+ }
}