diff options
author | hunt <hunt> | 2005-03-09 21:30:05 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-03-09 21:30:05 +0000 |
commit | 204b456c7c08bc40ffe1f21575461d92a544e92b (patch) | |
tree | d4eeb73b11437d723be1e91e0a431f2bd3bed025 /runtime/tests/testl64R.c | |
parent | 67b4cc78da121e708a21e96786cb373201e4f6ff (diff) | |
download | systemtap-steved-204b456c7c08bc40ffe1f21575461d92a544e92b.tar.gz systemtap-steved-204b456c7c08bc40ffe1f21575461d92a544e92b.tar.xz systemtap-steved-204b456c7c08bc40ffe1f21575461d92a544e92b.zip |
Initial runtime checkin.
Diffstat (limited to 'runtime/tests/testl64R.c')
-rw-r--r-- | runtime/tests/testl64R.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/runtime/tests/testl64R.c b/runtime/tests/testl64R.c new file mode 100644 index 00000000..b5db7228 --- /dev/null +++ b/runtime/tests/testl64R.c @@ -0,0 +1,50 @@ +#include "test.h" + +#define LLONG_MAX 9223372036854775807LL +#define LLONG_MIN (-LLONG_MAX - 1LL) + +/* testl64R.c - DO NOT EDIT without updating the expected results in map.test. */ + +/* + key - long + val - INT64 + + Testing range of values +*/ + +int main () +{ + struct map_node_int64 *ptr; + MAP mymap = map_new(4, INT64); + + map_key_long (mymap, 1); + map_set_int64 (mymap, LLONG_MIN); + map_key_long (mymap, 2); + map_set_int64 (mymap, LLONG_MAX); + map_key_long (mymap, 3); + map_set_int64 (mymap, 0); /* will not be saved */ + map_key_long (mymap, 4); + map_set_int64 (mymap, -1); + map_key_long (mymap, 5); + map_set_int64 (mymap, 5); + + + for (ptr = (struct map_node_int64 *)map_start(mymap); ptr; + ptr = (struct map_node_int64 *)map_iter (mymap, (struct map_node *)ptr)) + printf ("mymap[%ld] = %lld\n", key1int(ptr), (long long)ptr->val); + + + /* stress test - create a million entries then print last 4 */ + int i; + for (i = 0; i < 1000000; i++) + { + map_key_long (mymap, i); + map_set_int64 (mymap, i+i); + } + + for (ptr = (struct map_node_int64 *)map_start(mymap); ptr; + ptr = (struct map_node_int64 *)map_iter (mymap, (struct map_node *)ptr)) + printf ("mymap[%ld] = %lld\n", key1int(ptr), (long long)ptr->val); + + return 0; +} |