summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhunt <hunt>2005-07-28 18:45:24 +0000
committerhunt <hunt>2005-07-28 18:45:24 +0000
commit2445f52e036c87eea6471167cb8b89fb492e2eae (patch)
tree6b16e8fc64d0ea6cf37a1c550a256c911a41a85c
parent3d49c6154591958c1e12f70aa5b89de70e8fb988 (diff)
downloadsystemtap-steved-2445f52e036c87eea6471167cb8b89fb492e2eae.tar.gz
systemtap-steved-2445f52e036c87eea6471167cb8b89fb492e2eae.tar.xz
systemtap-steved-2445f52e036c87eea6471167cb8b89fb492e2eae.zip
Add test issii.c
-rw-r--r--runtime/tests/maps/issii.c38
-rw-r--r--runtime/tests/maps/map.test13
2 files changed, 51 insertions, 0 deletions
diff --git a/runtime/tests/maps/issii.c b/runtime/tests/maps/issii.c
new file mode 100644
index 00000000..4be3b776
--- /dev/null
+++ b/runtime/tests/maps/issii.c
@@ -0,0 +1,38 @@
+#include "runtime.h"
+
+/* test of maps with keys of int64,string.string.int64 and value of int64 */
+#define NEED_INT64_VALS
+#define KEY1_TYPE INT64
+#define KEY2_TYPE STRING
+#define KEY3_TYPE STRING
+#define KEY4_TYPE INT64
+#include "map-keys.c"
+
+#include "map.c"
+
+int main ()
+{
+ struct map_node *ptr;
+ MAP map = _stp_map_new_int64_str_str_int64(4, INT64);
+
+ _stp_map_key_int64_str_str_int64(map, 1, "Boston", "MA", 1970);
+ _stp_map_set_int64 (map, 5224303 );
+ _stp_map_key_int64_str_str_int64(map, 2, "Boston", "MA", 2000);
+ _stp_map_set_int64 (map, 6057826 );
+ _stp_map_key_int64_str_str_int64(map, 3, "Chicago", "IL", 2000);
+ _stp_map_set_int64 (map, 8272768 );
+
+
+ foreach (map, ptr)
+ printf ("map[%lld, %s, %s, %lld] = %lld\n",
+ key1int(ptr),
+ key2str(ptr),
+ _stp_key_get_str(ptr,3),
+ _stp_key_get_int64(ptr,4),
+ _stp_get_int64(ptr));
+
+
+ _stp_map_print(map,"%1d. The population of %2s, %3s in %4d was %d");
+ _stp_map_del (map);
+ return 0;
+}
diff --git a/runtime/tests/maps/map.test b/runtime/tests/maps/map.test
index 1e10caba..072fd9d0 100644
--- a/runtime/tests/maps/map.test
+++ b/runtime/tests/maps/map.test
@@ -423,6 +423,19 @@ mapsst[ Riga, Latvia] = 322D82
mapsst[ Sofia, Bulgaria] = 7E9
mapsst[ Valletta, Malta] = B22}
+
+test map_issii {Test of int64,string,string,int64 keys and int64 values} -setup {
+ exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test issii.c
+} -body {
+ exec ./test
+} -result {map[1, Boston, MA, 1970] = 5224303
+map[2, Boston, MA, 2000] = 6057826
+map[3, Chicago, IL, 2000] = 8272768
+1. The population of Boston, MA in 1970 was 5224303
+2. The population of Boston, MA in 2000 was 6057826
+3. The population of Chicago, IL in 2000 was 8272768
+}
+
exec rm test
cleanupTests