Index: test/cctest/compiler/test-run-jsbranches.cc |
diff --git a/test/cctest/compiler/test-run-jsbranches.cc b/test/cctest/compiler/test-run-jsbranches.cc |
index df2fcdcb6d68c5573a175e95eac8d5062a52b6e2..7a4a0b335b44e9b44c66171ea444cee9c9f3fe41 100644 |
--- a/test/cctest/compiler/test-run-jsbranches.cc |
+++ b/test/cctest/compiler/test-run-jsbranches.cc |
@@ -280,3 +280,78 @@ TEST(NestedForConditional) { |
T.CheckCall(T.Val(2), T.Val(2), T.false_value()); |
T.CheckCall(T.undefined(), T.Val(1), T.null()); |
} |
+ |
+ |
+TEST(IfTrue) { |
+ FunctionTester T("(function(a,b) { if (true) return a; return b; })"); |
+ |
+ T.CheckCall(T.Val(55), T.Val(55), T.Val(11)); |
+ T.CheckCall(T.Val(666), T.Val(666), T.Val(-444)); |
+} |
+ |
+ |
+TEST(TernaryTrue) { |
+ FunctionTester T("(function(a,b) { return true ? a : b; })"); |
+ |
+ T.CheckCall(T.Val(77), T.Val(77), T.Val(11)); |
+ T.CheckCall(T.Val(111), T.Val(111), T.Val(-444)); |
+} |
+ |
+ |
+TEST(IfFalse) { |
+ FunctionTester T("(function(a,b) { if (false) return a; return b; })"); |
+ |
+ T.CheckCall(T.Val(11), T.Val(22), T.Val(11)); |
+ T.CheckCall(T.Val(-555), T.Val(333), T.Val(-555)); |
+} |
+ |
+ |
+TEST(TernaryFalse) { |
+ FunctionTester T("(function(a,b) { return false ? a : b; })"); |
+ |
+ T.CheckCall(T.Val(99), T.Val(33), T.Val(99)); |
+ T.CheckCall(T.Val(-99), T.Val(-33), T.Val(-99)); |
+} |
+ |
+ |
+TEST(WhileTrue) { |
+ FunctionTester T("(function(a,b) { while (true) return a; return b; })"); |
+ |
+ T.CheckCall(T.Val(551), T.Val(551), T.Val(111)); |
+ T.CheckCall(T.Val(661), T.Val(661), T.Val(-444)); |
+} |
+ |
+ |
+TEST(WhileFalse) { |
+ FunctionTester T("(function(a,b) { while (false) return a; return b; })"); |
+ |
+ T.CheckCall(T.Val(115), T.Val(551), T.Val(115)); |
+ T.CheckCall(T.Val(-445), T.Val(661), T.Val(-445)); |
+} |
+ |
+ |
+TEST(DoWhileTrue) { |
+ FunctionTester T( |
+ "(function(a,b) { do { return a; } while (true); return b; })"); |
+ |
+ T.CheckCall(T.Val(7551), T.Val(7551), T.Val(7111)); |
+ T.CheckCall(T.Val(7661), T.Val(7661), T.Val(-7444)); |
+} |
+ |
+ |
+TEST(DoWhileFalse) { |
+ FunctionTester T( |
+ "(function(a,b) { do { " |
+ "; } while (false); return b; })"); |
+ |
+ T.CheckCall(T.Val(8115), T.Val(8551), T.Val(8115)); |
+ T.CheckCall(T.Val(-8445), T.Val(8661), T.Val(-8445)); |
+} |
+ |
+ |
+TEST(EmptyFor) { |
+ FunctionTester T("(function(a,b) { if (a) for(;;) ; return b; })"); |
+ |
+ T.CheckCall(T.Val(8126.1), T.Val(0.0), T.Val(8126.1)); |
+ T.CheckCall(T.Val(1123.1), T.Val(0.0), T.Val(1123.1)); |
+} |