Charj: Modified array example, that uses mainchare and 1D array.
authorJonathan Lifflander <jliffl2@illinois.edu>
Sat, 3 Jul 2010 21:35:11 +0000 (16:35 -0500)
committerJonathan Lifflander <jliffl2@illinois.edu>
Sat, 3 Jul 2010 21:35:11 +0000 (16:35 -0500)
src/langs/charj/tests/unit/ArrayTest.cj

index 623c81cf8f2d52b894350b7c7d4c06eedc5b0e32..fe5a4520a10a3fece5024534a966bb4f3da0504e 100644 (file)
@@ -1,14 +1,22 @@
 
-class ArrayTest {
-      Array<int> test[10];
+public mainchare ArrayTest {
+      public entry ArrayTest(CkArgMsg msg) {
+           thisProxy@entry1();
+      }
 
-      void test() {
-           test[0] = 0;
+      public entry void entry1() {
+           Array<int> test = new Array<int>([10]);
 
-          int i;
+          for (int i = 0; i < test.size(); i++) {
+               test[i] = i;
+           }
 
-          for (i = 0; i < 10; i++) {
-               test[i] = 0;
+           for (int i = 0; i < test.size(); i++) {
+                printf("%d\n", test[i]);
            }
+
+           delete test;
+
+           CkExit();
       }
 }