summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/tests/frames/loop.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/tests/frames/loop.asy')
-rw-r--r--Build/source/utils/asymptote/tests/frames/loop.asy167
1 files changed, 167 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/tests/frames/loop.asy b/Build/source/utils/asymptote/tests/frames/loop.asy
index ceb65a1ff56..a4714d1f8da 100644
--- a/Build/source/utils/asymptote/tests/frames/loop.asy
+++ b/Build/source/utils/asymptote/tests/frames/loop.asy
@@ -26,4 +26,171 @@ for (int i=0; i<10; ++i) {
}
assert(f()==70);
+{
+ int y = 3;
+ int z = 0;
+ for (int i = 0; i < 7; ++i)
+ {
+ ++z;
+ continue;
+ y = 4;
+ }
+ assert(y == 3);
+ assert(z == 7);
+}
+{
+ int y = 3;
+ int z = 0;
+ for (int i = 0; i < 7; ++i)
+ {
+ ++z;
+ break;
+ y = 4;
+ }
+ assert(y == 3);
+ assert(z == 1);
+}
+{
+ int y = 3;
+ int z = 0;
+ for (int i = 0; i < 7; ++i)
+ {
+ void g() {}
+ ++z;
+ continue;
+ y = 4;
+ }
+ assert(y == 3);
+ assert(z == 7);
+}
+{
+ int y = 3;
+ int z = 0;
+ for (int i = 0; i < 7; ++i)
+ {
+ void g() {}
+ ++z;
+ break;
+ y = 4;
+ }
+ assert(y == 3);
+ assert(z == 1);
+}
+
+// While loops
+{
+ int y = 7;
+ int z = 0;
+ while (z < 10) {
+ ++z;
+ continue;
+ ++y;
+ }
+ assert(z == 10);
+ assert(y == 7);
+}
+
+{
+ int y = 7;
+ int z = 0;
+ while (z < 10) {
+ void g() {}
+ ++z;
+ continue;
+ ++y;
+ }
+ assert(z == 10);
+ assert(y == 7);
+}
+
+{
+ int y = 7;
+ int z = 0;
+ while (z < 10) {
+ ++z;
+ break;
+ ++y;
+ }
+ assert(z == 1);
+ assert(y == 7);
+}
+
+{
+ int y = 7;
+ int z = 0;
+ while (z < 10) {
+ void g() {}
+ ++z;
+ break;
+ ++y;
+ }
+ assert(z == 1);
+ assert(y == 7);
+}
+
+
+{
+ int y = 7;
+ int z = 0;
+ while (z < 10) {
+ ++z;
+ continue;
+ ++y;
+ }
+ assert(z == 10);
+ assert(y == 7);
+}
+
+// Do loops
+{
+ int y = 7;
+ int z = 0;
+ do {
+ void g() {}
+ ++z;
+ continue;
+ ++y;
+ } while (z < 10);
+ assert(z == 10);
+ assert(y == 7);
+}
+
+{
+ int y = 7;
+ int z = 0;
+ do {
+ ++z;
+ break;
+ ++y;
+ } while (z < 10);
+ assert(z == 1);
+ assert(y == 7);
+}
+
+{
+ int y = 7;
+ int z = 0;
+ do {
+ void g() {}
+ ++z;
+ break;
+ ++y;
+ } while (z < 10);
+ assert(z == 1);
+ assert(y == 7);
+}
+
+{
+ int x = 456;
+ do { x = 123; } while (false);
+ assert(x == 123);
+}
+
+{
+ int x = 456;
+ do { void g() {} x = 123; } while (false);
+ assert(x == 123);
+}
+
+
EndTest();