[Swift-commit] r7625 - in branches/release-0.94/tests/language-behaviour: . associative_array

yadunandb at ci.uchicago.edu yadunandb at ci.uchicago.edu
Fri Feb 28 14:48:33 CST 2014


Author: yadunandb
Date: 2014-02-28 14:48:32 -0600 (Fri, 28 Feb 2014)
New Revision: 7625

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

Test cases for associative arrays, and append functionality



Added: branches/release-0.94/tests/language-behaviour/associative_array/append0.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/append0.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/append0.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/append1.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/append1.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/append1.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/append2.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/append2.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/append2.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/append3.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/append3.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/append3.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -0,0 +1,7 @@
+int array[int][string][auto];
+
+array[1]["hey"] << 5;
+array[1]["hey"] << 10;
+array[1]["hey"] << 20;
+
+

Added: branches/release-0.94/tests/language-behaviour/associative_array/append4.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/append4.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/append4.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/assoc_array.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/assoc_array.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/assoc_array.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/clean.sh
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/clean.sh	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/clean.sh	2014-02-28 20:48:32 UTC (rev 7625)
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+rm -rf *swiftx *kml *d *-*log *~ run0*


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

Added: branches/release-0.94/tests/language-behaviour/associative_array/doc_test.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/doc_test.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/doc_test.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/foreach1.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/foreach1.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/foreach1.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/foreach2.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/foreach2.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/foreach2.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/foreach3.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/foreach3.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/foreach3.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/foreach4.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/foreach4.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/foreach4.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/foreach5.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/foreach5.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/foreach5.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/foreach_range.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/foreach_range.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/foreach_range.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -0,0 +1,4 @@
+
+foreach a,i in [0:9] {
+	trace(a,i);
+}

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

Added: branches/release-0.94/tests/language-behaviour/associative_array/multidim_assoc.swift
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/multidim_assoc.swift	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/multidim_assoc.swift	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/run_tests.sh
===================================================================
--- branches/release-0.94/tests/language-behaviour/associative_array/run_tests.sh	                        (rev 0)
+++ branches/release-0.94/tests/language-behaviour/associative_array/run_tests.sh	2014-02-28 20:48:32 UTC (rev 7625)
@@ -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: branches/release-0.94/tests/language-behaviour/associative_array/run_tests.sh
___________________________________________________________________
Added: svn:executable
   + *




More information about the Swift-commit mailing list