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.asy29
1 files changed, 29 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/tests/frames/loop.asy b/Build/source/utils/asymptote/tests/frames/loop.asy
new file mode 100644
index 00000000000..ceb65a1ff56
--- /dev/null
+++ b/Build/source/utils/asymptote/tests/frames/loop.asy
@@ -0,0 +1,29 @@
+import TestLib;
+StartTest("loop");
+
+int f();
+for (int i=0; i<10; ++i) {
+ int x=i;
+ for (int j=0; j<10; ++j) {
+ int y=j;
+ if (i==5 && j==7) {
+ f = new int () { return x*y; };
+ }
+ }
+}
+assert(f()==35);
+
+int f();
+
+for (int i=0; i<10; ++i) {
+ int x=i;
+ for (int j=0; j<10; ++j) {
+ int y=j;
+ if (i==5 && j==7) {
+ f = new int () { return i*y; };
+ }
+ }
+}
+assert(f()==70);
+
+EndTest();