[Swift-commit] r6079 - trunk/tests/language-behaviour/arrays
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Fri Nov 23 03:00:47 CST 2012
Author: hategan
Date: 2012-11-23 03:00:46 -0600 (Fri, 23 Nov 2012)
New Revision: 6079
Added:
trunk/tests/language-behaviour/arrays/201-closing-if-in-foreach.swift
trunk/tests/language-behaviour/arrays/202-closing-if-in-if-1.swift
trunk/tests/language-behaviour/arrays/203-closing-foreach-in-if.swift
trunk/tests/language-behaviour/arrays/205-closing-if-in-if-2.swift
trunk/tests/language-behaviour/arrays/206-closing-one-writer.swift
trunk/tests/language-behaviour/arrays/207-closing-no-writers.swift
trunk/tests/language-behaviour/arrays/208-closing-self-closing.swift
trunk/tests/language-behaviour/arrays/209-closing-return-array.swift
trunk/tests/language-behaviour/arrays/bug-696.swift
Log:
added various tests for new reference counting code
Added: trunk/tests/language-behaviour/arrays/201-closing-if-in-foreach.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/201-closing-if-in-foreach.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/201-closing-if-in-foreach.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,20 @@
+(int r) f(int[] b) {
+ foreach i in b {
+ trace(i);
+ }
+ r = 1;
+}
+
+int a[];
+
+int[] r;
+
+foreach i in [0:10] {
+ if (true) {
+ a[i] = 1;
+ }
+ else {
+ a[i] = 2;
+ }
+ r[i] = f(a);
+}
Added: trunk/tests/language-behaviour/arrays/202-closing-if-in-if-1.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/202-closing-if-in-if-1.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/202-closing-if-in-if-1.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,18 @@
+(int r) f(int[] b) {
+ foreach i in b {
+ trace(i);
+ }
+ r = 1;
+}
+
+
+int[] a;
+int r;
+
+if (true) {
+ if (false) {
+ a[0] = 1;
+ }
+ r = f(a);
+}
+
Added: trunk/tests/language-behaviour/arrays/203-closing-foreach-in-if.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/203-closing-foreach-in-if.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/203-closing-foreach-in-if.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,20 @@
+(int r) f(int[] b) {
+ foreach i in b {
+ trace(i);
+ }
+ r = 1;
+}
+
+
+int[] a;
+int r;
+
+if (true) {
+ foreach j in [0:10] {
+ if (true) {
+ a[j] = 1;
+ }
+ }
+ r = f(a);
+}
+
Added: trunk/tests/language-behaviour/arrays/205-closing-if-in-if-2.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/205-closing-if-in-if-2.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/205-closing-if-in-if-2.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,21 @@
+(int r) f(int[] b) {
+ foreach i in b {
+ trace(i);
+ }
+ r = 1;
+}
+
+
+int[] a;
+int r;
+
+if (true) {
+ if (true) {
+ a[0] = 1;
+ }
+ r = f(a);
+}
+else {
+ a[1] = 1;
+}
+
Added: trunk/tests/language-behaviour/arrays/206-closing-one-writer.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/206-closing-one-writer.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/206-closing-one-writer.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,6 @@
+int[] a;
+a[0] = 1;
+
+foreach i in a {
+ trace(i);
+}
\ No newline at end of file
Added: trunk/tests/language-behaviour/arrays/207-closing-no-writers.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/207-closing-no-writers.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/207-closing-no-writers.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,5 @@
+int[] a;
+
+foreach i in a {
+ trace(i);
+}
\ No newline at end of file
Added: trunk/tests/language-behaviour/arrays/208-closing-self-closing.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/208-closing-self-closing.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/208-closing-self-closing.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,15 @@
+int[] a;
+a[3] = 1;
+int[][] b;
+
+foreach v, k in a {
+ if (k < 100) {
+ a[k + 10] = 1;
+ }
+ trace(k);
+}
+
+foreach i in [0:2] {
+ a[i] = 1;
+ b[0][i] = 2;
+}
Added: trunk/tests/language-behaviour/arrays/209-closing-return-array.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/209-closing-return-array.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/209-closing-return-array.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,14 @@
+int[] a;
+
+(int[] r) f() {
+ foreach i in [0:9] {
+ r[i] = i;
+ r[i + 10] = i + 10;
+ }
+}
+
+a = f();
+
+foreach v in a {
+ trace(v);
+}
\ No newline at end of file
Added: trunk/tests/language-behaviour/arrays/bug-696.swift
===================================================================
--- trunk/tests/language-behaviour/arrays/bug-696.swift (rev 0)
+++ trunk/tests/language-behaviour/arrays/bug-696.swift 2012-11-23 09:00:46 UTC (rev 6079)
@@ -0,0 +1,25 @@
+main()
+{
+ foreach i in [0:0] {
+ int ia[];
+ if(true) {
+ foreach j in [0:1] {
+ if (j==0) {
+ ia[j] = 100;
+ }
+ else {
+ ia[j] = 101;
+ }
+ }
+ sub(ia);
+ }
+ }
+}
+
+sub(int iap[])
+{
+ tracef("in sub: entered\n");
+ tracef("in sub: iap=%q\n",iap);
+}
+
+main();
More information about the Swift-commit
mailing list