diff options
author | hunt <hunt> | 2005-10-26 17:39:08 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-10-26 17:39:08 +0000 |
commit | e410f5355199535bca6cd1db01966312c8c9c7b5 (patch) | |
tree | 542228f5b31979f6052d939dac8e847ee3ad0db6 | |
parent | af5dd76bca996577262e447fd8bff1bd0df30db7 (diff) | |
download | systemtap-steved-e410f5355199535bca6cd1db01966312c8c9c7b5.tar.gz systemtap-steved-e410f5355199535bca6cd1db01966312c8c9c7b5.tar.xz systemtap-steved-e410f5355199535bca6cd1db01966312c8c9c7b5.zip |
2005-10-26 Martin Hunt <hunt@redhat.com>
* maps/map.test: Add results for issii2.
-rw-r--r-- | runtime/tests/ChangeLog | 4 | ||||
-rw-r--r-- | runtime/tests/maps/issii2.c | 34 | ||||
-rw-r--r-- | runtime/tests/maps/map.test | 12 |
3 files changed, 50 insertions, 0 deletions
diff --git a/runtime/tests/ChangeLog b/runtime/tests/ChangeLog index 91e6bb10..b157b076 100644 --- a/runtime/tests/ChangeLog +++ b/runtime/tests/ChangeLog @@ -1,5 +1,9 @@ 2005-10-26 Martin Hunt <hunt@redhat.com> + * maps/map.test: Add results for issii2. + +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. diff --git a/runtime/tests/maps/issii2.c b/runtime/tests/maps/issii2.c new file mode 100644 index 00000000..4861428a --- /dev/null +++ b/runtime/tests/maps/issii2.c @@ -0,0 +1,34 @@ +#include "runtime.h" + +/* test of maps with keys of int64,string.string.int64 and value of int64 */ +#define VALUE_TYPE INT64 +#define KEY1_TYPE INT64 +#define KEY2_TYPE STRING +#define KEY3_TYPE STRING +#define KEY4_TYPE INT64 +#include "map-gen.c" + +#include "map.c" + +int main () +{ + struct map_node *ptr; + MAP map = _stp_map_new_issii(4); + + _stp_map_set_issii (map, 1, "Boston", "MA", 1970, 5224303 ); + _stp_map_set_issii (map, 2, "Boston", "MA", 2000, 6057826 ); + _stp_map_set_issii (map, 3, "Chicago", "IL", 2000, 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 d827a207..5562910b 100644 --- a/runtime/tests/maps/map.test +++ b/runtime/tests/maps/map.test @@ -603,6 +603,18 @@ map[3, Chicago, IL, 2000] = 8272768 3. The population of Chicago, IL in 2000 was 8272768 } +test map_issii2 {Test of int64,string,string,int64 keys and int64 values} -setup { + exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test issii2.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 +} + test map_sort {Test of sorting} -setup { exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test sort.c } -body { |