[Swift-commit] r7626 - in trunk/tests/language-behaviour: . associative_array

yadunandb at ci.uchicago.edu yadunandb at ci.uchicago.edu
Fri Feb 28 14:52:41 CST 2014


Author: yadunandb
Date: 2014-02-28 14:52:39 -0600 (Fri, 28 Feb 2014)
New Revision: 7626

Added:
   trunk/tests/language-behaviour/associative_array/
   trunk/tests/language-behaviour/associative_array/append0.swift
   trunk/tests/language-behaviour/associative_array/append1.swift
   trunk/tests/language-behaviour/associative_array/append2.swift
   trunk/tests/language-behaviour/associative_array/append3.swift
   trunk/tests/language-behaviour/associative_array/append4.swift
   trunk/tests/language-behaviour/associative_array/assoc_array.swift
   trunk/tests/language-behaviour/associative_array/clean.sh
   trunk/tests/language-behaviour/associative_array/doc_test.swift
   trunk/tests/language-behaviour/associative_array/foreach1.swift
   trunk/tests/language-behaviour/associative_array/foreach2.swift
   trunk/tests/language-behaviour/associative_array/foreach3.swift
   trunk/tests/language-behaviour/associative_array/foreach4.swift
   trunk/tests/language-behaviour/associative_array/foreach5.swift
   trunk/tests/language-behaviour/associative_array/foreach_range.swift
   trunk/tests/language-behaviour/associative_array/multidim_arrays.swift
   trunk/tests/language-behaviour/associative_array/multidim_assoc.swift
   trunk/tests/language-behaviour/associative_array/run_tests.sh
Log:

Committing tests for associative array, and append operator.



Added: trunk/tests/language-behaviour/associative_array/append0.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/append0.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/append0.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,7 @@
+int a[auto];
+a << 1;
+a << 2;
+
+foreach v,i in a {
+	trace ( v, i, a[i]);
+}
\ No newline at end of file

Added: trunk/tests/language-behaviour/associative_array/append1.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/append1.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/append1.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,11 @@
+int array[int][auto];
+
+array[1] << 5;
+array[1] << 10;
+array[1] << 20;
+
+foreach v,i in array[1]{
+	trace ( v, i );
+}
+
+

Added: trunk/tests/language-behaviour/associative_array/append2.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/append2.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/append2.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,9 @@
+int array[auto];
+
+foreach v in [0:2]{
+	array << v;
+}
+
+foreach v,i in array{
+	trace (v,i, array[i]);
+}
\ No newline at end of file

Added: trunk/tests/language-behaviour/associative_array/append3.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/append3.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/append3.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,7 @@
+int array[int][string][auto];
+
+array[1]["hey"] << 5;
+array[1]["hey"] << 10;
+array[1]["hey"] << 20;
+
+

Added: trunk/tests/language-behaviour/associative_array/append4.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/append4.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/append4.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,9 @@
+int a[auto];
+
+foreach v in [0:4] {
+	a << v ;
+}
+
+foreach v,i in a {
+	trace ( v, i, a[i]);
+}
\ No newline at end of file

Added: trunk/tests/language-behaviour/associative_array/assoc_array.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/assoc_array.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/assoc_array.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,23 @@
+int a[];
+a[5] = 10;
+trace(a[5]);
+
+int b[string];
+b["hey"] = 23;
+trace(b["hey"]);
+
+int c[int];
+c[5] = 100;
+trace(c[5]);
+
+string d[string];
+d["a"] = "hello";
+trace(d["a"]);
+
+int e[boolean];
+e[true] = 1001;
+trace(e[true]);
+
+string f[int][string];
+f[1]["hey"] = "lola";
+trace(f[1]["hey"]);
\ No newline at end of file

Added: trunk/tests/language-behaviour/associative_array/clean.sh
===================================================================
--- trunk/tests/language-behaviour/associative_array/clean.sh	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/clean.sh	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+rm -rf *swiftx *kml *d *-*log *~ run0*


Property changes on: trunk/tests/language-behaviour/associative_array/clean.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tests/language-behaviour/associative_array/doc_test.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/doc_test.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/doc_test.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,10 @@
+int[auto] array;
+
+foreach i in [1:100] {
+    array << (i*2);
+}
+
+
+foreach item in array {
+    tracef("Item : %i \n", item);
+}

Added: trunk/tests/language-behaviour/associative_array/foreach1.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/foreach1.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/foreach1.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,9 @@
+int array[int];
+
+array[1] = 10;
+array[2] = 20;
+array[3] = 30;
+
+foreach v,i in array{
+	trace ( array[i], i );
+}
\ No newline at end of file

Added: trunk/tests/language-behaviour/associative_array/foreach2.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/foreach2.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/foreach2.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,9 @@
+int array[int][auto];
+
+array[1] << 5;
+array[1] << 10;
+array[1] << 20;
+
+foreach v,i in array[1]{
+	trace( v, i);
+}
\ No newline at end of file

Added: trunk/tests/language-behaviour/associative_array/foreach3.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/foreach3.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/foreach3.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,10 @@
+int array[int][string][auto];
+
+array[1]["hey"] << 5;
+array[1]["hey"] << 10;
+array[1]["hey"] << 20;
+
+
+foreach v,i in array[1]["hey"]{
+	trace( array[1]["hey"][i], i);
+}

Added: trunk/tests/language-behaviour/associative_array/foreach4.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/foreach4.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/foreach4.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,12 @@
+int array[int][string];
+
+array[1]["a"] = 5;
+array[1]["b"] = 10;
+array[1]["c"] = 15;
+array[1]["d"] = 20;
+array[1]["e"] = 25;
+
+
+foreach v,i in array[1]{
+	trace( v, i);
+}

Added: trunk/tests/language-behaviour/associative_array/foreach5.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/foreach5.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/foreach5.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,20 @@
+type mystruct{
+    int a;
+    int b;
+}
+
+int array[int][mystruct];
+
+mystruct xx,yy;
+xx.a = 1;
+xx.b = 2;
+
+yy.a = 101;
+yy.b = 202;
+
+array[1][xx] = 55;
+array[1][yy] = 11;
+
+foreach v in array[1]{
+	trace(v);
+}
\ No newline at end of file

Added: trunk/tests/language-behaviour/associative_array/foreach_range.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/foreach_range.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/foreach_range.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,4 @@
+
+foreach a,i in [0:9] {
+	trace(a,i);
+}

Added: trunk/tests/language-behaviour/associative_array/multidim_arrays.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/multidim_arrays.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/multidim_arrays.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,5 @@
+string greetings[int][int];
+
+greetings = [ [ "left", "right" ], ["up", "down"]];
+
+trace (greetings[1][0]);
\ No newline at end of file

Added: trunk/tests/language-behaviour/associative_array/multidim_assoc.swift
===================================================================
--- trunk/tests/language-behaviour/associative_array/multidim_assoc.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/multidim_assoc.swift	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,44 @@
+int array1[int][string][int][string];
+
+array1[0]["a"][0]["a"] = 1;
+array1[0]["a"][0]["b"] = 1;
+array1[0]["a"][1]["a"] = 1;
+array1[0]["a"][1]["b"] = 1;
+
+array1[0]["b"][0]["a"] = 1;
+array1[0]["b"][0]["b"] = 1;
+array1[0]["b"][1]["a"] = 1;
+array1[0]["b"][1]["b"] = 1;
+
+array1[1]["a"][0]["a"] = 1;
+array1[1]["a"][0]["b"] = 1;
+array1[1]["a"][1]["a"] = 1;
+array1[1]["a"][1]["b"] = 1;
+
+array1[1]["b"][0]["a"] = 1;
+array1[1]["b"][0]["b"] = 1;
+array1[1]["b"][1]["a"] = 1;
+array1[1]["b"][1]["b"] = 1;
+
+foreach v0,i0 in array1{
+	trace(v0,i0);
+}
+
+foreach v1,i1 in array1[0]{
+	trace(v1,i1);
+}
+
+foreach v2,i2 in array1[0]["a"]{
+	trace(v2,i2);
+}
+
+foreach v3,i3 in array1[0]["a"][1]{
+	trace(v3,i3);
+}
+
+// Following loop fails, "in" is not an array 
+//foreach v4,i4 in array1[0]["a"][1]["a"]{
+//	trace(v4,i4);
+//}
+
+

Added: trunk/tests/language-behaviour/associative_array/run_tests.sh
===================================================================
--- trunk/tests/language-behaviour/associative_array/run_tests.sh	                        (rev 0)
+++ trunk/tests/language-behaviour/associative_array/run_tests.sh	2014-02-28 20:52:39 UTC (rev 7626)
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+LOG="$RANDOM.log"
+
+echo "Running with $(swift -version)" >> $LOG
+for testcase in $(ls *.swift)
+do
+    echo "STARTING $testcase-----------------------------------" | tee $LOG
+    swift $testcase | tee -a $LOG
+    echo "ENDING $testcase-------------------------------------" | tee $LOG
+done


Property changes on: trunk/tests/language-behaviour/associative_array/run_tests.sh
___________________________________________________________________
Added: svn:executable
   + *




More information about the Swift-commit mailing list