summaryrefslogtreecommitdiffstats
path: root/runtime/tests/maps/iiss2.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-10-26 08:08:53 +0000
committerhunt <hunt>2005-10-26 08:08:53 +0000
commitd06fc47a2be5a31f770595211a719fe0e6c0cc13 (patch)
tree980f15972175169238b8f4942b261d9e72943a60 /runtime/tests/maps/iiss2.c
parent1dcb36dc4ad16c1b842d0961cd6a5d8e57c97b87 (diff)
downloadsystemtap-steved-d06fc47a2be5a31f770595211a719fe0e6c0cc13.tar.gz
systemtap-steved-d06fc47a2be5a31f770595211a719fe0e6c0cc13.tar.xz
systemtap-steved-d06fc47a2be5a31f770595211a719fe0e6c0cc13.zip
2005-10-26 Martin Hunt <hunt@redhat.com>
* maps/map.test: Update with results for new tests. * maps/*2.c: Tests for the new API. * maps/ist.c: Renamed isx.c. * maps/setadd.c: New test of adding and setting.
Diffstat (limited to 'runtime/tests/maps/iiss2.c')
-rw-r--r--runtime/tests/maps/iiss2.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/runtime/tests/maps/iiss2.c b/runtime/tests/maps/iiss2.c
new file mode 100644
index 00000000..56c3d186
--- /dev/null
+++ b/runtime/tests/maps/iiss2.c
@@ -0,0 +1,43 @@
+#include "runtime.h"
+
+/* test of maps with keys of int64,int64,string and value of string */
+#define VALUE_TYPE STRING
+#define KEY1_TYPE INT64
+#define KEY2_TYPE INT64
+#define KEY3_TYPE STRING
+#include "map-gen.c"
+
+#include "map.c"
+
+int main ()
+{
+ MAP map = _stp_map_new_iiss(4);
+ map->wrap = 1;
+
+ _stp_map_set_iiss (map, 1,2,"Ohio", "Columbus" );
+ _stp_map_set_iiss (map, 3,4,"California", "Sacramento" );
+ _stp_map_set_iiss (map, 5,6,"Washington", "Seattle" );
+ _stp_map_set_iiss (map, 7,8,"Oregon", "Salem" );
+ _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
+
+ _stp_map_set_iiss (map, -9,-10,"Nevada", "Carson City" );
+ _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
+
+ _stp_map_set_iiss (map, 5,6,"Washington", "Olymp" );
+ _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
+
+ _stp_map_add_iiss (map, 5,6,"Washington", "is" );
+ _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
+
+ _stp_map_set_iiss (map, 5,6,"Washington", "Olympia" );
+ _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
+
+ _stp_map_set_iiss (map, -9,-10,"Nevada", 0);
+ _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
+
+ _stp_map_set_iiss(map, 0,0,"", "");
+ _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
+
+ _stp_map_del (map);
+ return 0;
+}