Index: /branches/eam_branches/ipp-20130711/Ohana/src/opihi/cmd.data/test/join.sh
===================================================================
--- /branches/eam_branches/ipp-20130711/Ohana/src/opihi/cmd.data/test/join.sh	(revision 36023)
+++ /branches/eam_branches/ipp-20130711/Ohana/src/opihi/cmd.data/test/join.sh	(revision 36023)
@@ -0,0 +1,110 @@
+
+list tests
+ test1
+ memtest1
+end
+
+# Test if imhist works
+macro test1
+
+ $PASS = 1
+
+ local i
+
+ delete ID1 ID2
+
+ vlist -int ID1 1   2   3   4   5   6
+ vlist val1     0.1 4.3 2.1 5.5 2.1 4.2
+
+ vlist -int ID2 5   3   1   6
+ vlist val      0.3 2.3 1.1 2.5
+
+ join ID1 ID2 
+
+mana: for i 0 index1[]
+>> echo index1[$i] index2[$i]
+>> end
+0 2
+2 1
+4 0
+5 3
+mana: join ID1 ID2 -outer
+mana: vectors 
+    N       name      size
+    0        ID1          6 (INT)
+    1       val1          6 (FLT)
+    2        ID2          4 (INT)
+    3        val          4 (FLT)
+    4     index1          6 (INT)
+    5     index2          4 (INT)
+mana: for i 0 index1[]
+>> echo index1[$i]
+>> end
+2
+-1
+1
+-1
+0
+3
+mana: echo ID1[2]
+3
+mana: echo ID1[0] ID2[2]
+1 1
+mana: for i 0 index1[]
+>> if (index1[$i] == -1) continue
+>> $N = index1[$i]
+>> echo $i index1[$i] ID1[$i] ID2[$N]
+>> end
+0 2 1 1
+2 1 3 3
+4 0 5 5
+5 3 6 6
+mana: for i 0 index2[]
+>> if (index2[$i] == -1) continue
+>> $N = index2[$i]
+>> echo $i index2[$i] ID2[$i] ID1[$N]
+>> end
+0 4 5 5
+1 2 3 3
+2 0 1 1
+3 5 6 6
+mana: 
+
+ # if ((xvec[1024] != 17) || (yvec[1024] != 100))
+ #  $PASS = 0
+ #  echo "Value mismatch: xvec[1024] yvec[1024] (should be 17,100)"
+ # end
+ # 
+ # imhist -q buff xvec yvec -region 40 0 25 10 -range 0 10
+ # 
+ # if ((xvec[1024] != 10) || (yvec[1024] != 100))
+ #  $PASS = 0
+ #  echo "Value mismatch: xvec[1024] yvec[1024] (should be 10,100)"
+ # end
+
+end
+
+
+# Memory test
+macro memtest1
+
+ local i
+
+ list word -x "ps -p $PID -o rss"
+ $startmem = $word:1
+
+ for i 0 1000
+  imhist -q buff xvec yvec -region 40 0 25 10 -range 0 10
+ end
+
+ list word -x "ps -p $PID -o rss"
+ $endmem = $word:1
+
+ $PASS = 1
+
+ if ($endmem - $startmem > 10)
+   $PASS = 0
+   echo "growth: {$endmem-$startmem}"
+   echo "kB/loop: {($endmem-$startmem)/1000}"
+ end
+end
