summaryrefslogtreecommitdiffstats
path: root/runtime/tests/maps
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/tests/maps')
-rw-r--r--runtime/tests/maps/Makefile5
-rw-r--r--runtime/tests/maps/README4
-rw-r--r--runtime/tests/maps/all.tcl5
-rw-r--r--runtime/tests/maps/ii.c96
-rw-r--r--runtime/tests/maps/iiiiii.c36
-rw-r--r--runtime/tests/maps/iiss.c45
-rw-r--r--runtime/tests/maps/is.c119
-rw-r--r--runtime/tests/maps/issii.c34
-rw-r--r--runtime/tests/maps/isx.c41
-rw-r--r--runtime/tests/maps/map.test999
-rw-r--r--runtime/tests/maps/map_format.c72
-rw-r--r--runtime/tests/maps/setadd.c245
-rw-r--r--runtime/tests/maps/si.c125
-rw-r--r--runtime/tests/maps/size.c103
-rw-r--r--runtime/tests/maps/sort.c105
-rw-r--r--runtime/tests/maps/sort2.c105
-rw-r--r--runtime/tests/maps/sort_stat.c90
-rw-r--r--runtime/tests/maps/ssssss.c37
18 files changed, 0 insertions, 2266 deletions
diff --git a/runtime/tests/maps/Makefile b/runtime/tests/maps/Makefile
deleted file mode 100644
index c396c132..00000000
--- a/runtime/tests/maps/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-default: tests
-
-tests:
- tclsh all.tcl
-
diff --git a/runtime/tests/maps/README b/runtime/tests/maps/README
deleted file mode 100644
index 3ff31703..00000000
--- a/runtime/tests/maps/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Read ../README first!
-
-The *.c files test associative arrays (maps). "make tests" to run.
-
diff --git a/runtime/tests/maps/all.tcl b/runtime/tests/maps/all.tcl
deleted file mode 100644
index c0b38a0e..00000000
--- a/runtime/tests/maps/all.tcl
+++ /dev/null
@@ -1,5 +0,0 @@
-package require tcltest
-namespace import -force tcltest::*
-tcltest::testsDirectory [file dir [info script]]
-tcltest::runAllTests
-
diff --git a/runtime/tests/maps/ii.c b/runtime/tests/maps/ii.c
deleted file mode 100644
index 51b0d766..00000000
--- a/runtime/tests/maps/ii.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "runtime.h"
-
-/* test of maps with keys of int64 and value of int64 */
-#define VALUE_TYPE INT64
-#define KEY1_TYPE INT64
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- MAP map = _stp_map_new_ii(4);
- int64_t x;
-
- dbug("Hello World\n");
-
- /* map[1] = 2 */
- _stp_map_set_ii(map, 1, 2);
- x = _stp_map_get_ii(map, 1);
- printf ("map[1]=%lld\n", x);
-
- /* map[3] = 4 */
- _stp_map_set_ii(map, 3, 4);
- _stp_map_print(map,"map[%1d] = %d");
-
- /* now try to confuse things */
- /* These won't do anything useful, but shouldn't crash */
- _stp_map_set_ii(0,1,100);
- _stp_map_set_ii(map,0,0);
- _stp_map_set_ii(map,100,0);
- _stp_map_print(map,"map[%1d] = %d");
-
- /* check that unset values are 0 */
- printf ("%lld (should be 0)\n", _stp_map_get_ii(map, 5));
-
- /* map[5] = 6 */
- _stp_map_set_ii(map, 5, 6);
- _stp_map_print(map,"map[%1d] = %d");
-
- /* set wrap */
- map->wrap = 1;
- /* add 4 new entries, pushing the others out */
- int i, res;
- for (i = 6; i < 10; i++) {
- res = _stp_map_set_ii (map, i, 100 + i);
- if (res)
- printf("WARNING: During wrap test, got result of %d when expected 0\n", res);
- }
- _stp_map_print(map,"map[%1d] = %d");
-
- /* turn off wrap and repeat */
- map->wrap = 0;
- for (i = 16; i < 20; i++) {
- res = _stp_map_set_ii (map, i, 100 + i);
- if (res != -1)
- printf("WARNING: During wrap test, got result of %d when expected -1\n", res);
- }
-
- map->wrap = 1;
-
- /* 5, 382, 526, and 903 all hash to the same value (23) */
- /* use them to test the hash chain */
- _stp_map_set_ii (map, 5, 1005);
- _stp_map_set_ii (map, 382, 1382);
- _stp_map_set_ii (map, 526, 1526);
- _stp_map_set_ii (map, 903, 1903);
- _stp_map_print(map,"map[%1d] = %d");
-
-
- /* now delete all 4 nodes, one by one */
- _stp_map_set_ii (map, 382, 0);
- _stp_map_print(map,"map[%1d] = %d");
-
- _stp_map_set_ii (map, 5, 0);
- _stp_map_print(map,"map[%1d] = %d");
-
- _stp_map_set_ii (map, 903, 0);
- _stp_map_print(map,"map[%1d] = %d");
-
- _stp_map_set_ii (map, 526, 0);
- _stp_map_print(map,"map[%1d] = %d");
-
- /* finally check clearing the map */
- for (i = 33; i < 77; i+=11)
- _stp_map_set_ii (map, i, 100*i+i);
-
- _stp_map_print(map,"map[%1d] = %d");
-
- _stp_map_clear(map);
- _stp_map_print(map,"map[%1d] = %d");
- _stp_map_set_ii (map, 1970, 1799);
- _stp_map_print(map,"map[%1d] = %d");
-
- _stp_map_del (map);
- return 0;
-}
diff --git a/runtime/tests/maps/iiiiii.c b/runtime/tests/maps/iiiiii.c
deleted file mode 100644
index a5eeef70..00000000
--- a/runtime/tests/maps/iiiiii.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "runtime.h"
-
-/* test of maps with 5 keys of int64 and value of int64 */
-#define VALUE_TYPE INT64
-#define KEY1_TYPE INT64
-#define KEY2_TYPE INT64
-#define KEY3_TYPE INT64
-#define KEY4_TYPE INT64
-#define KEY5_TYPE INT64
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- struct map_node *ptr;
- MAP map = _stp_map_new_iiiiii(4);
-
- _stp_map_set_iiiiii (map,1,2,3,4,5, 10);
- _stp_map_set_iiiiii (map,10,20,30,40,50, 100);
- _stp_map_set_iiiiii (map,-1,-2,-3,-4,-5, -10);
- _stp_map_set_iiiiii (map,100,200,300,400,500, 1000);
-
- foreach (map, ptr)
- printf ("map[%lld, %lld, %lld, %lld, %lld] = %lld\n",
- _stp_key_get_int64(ptr,1),
- _stp_key_get_int64(ptr,2),
- _stp_key_get_int64(ptr,3),
- _stp_key_get_int64(ptr,4),
- _stp_key_get_int64(ptr,5),
- _stp_get_int64(ptr));
-
- _stp_map_print(map,"%1d - %2d - %3d - %4d - %5d *** %d");
- _stp_map_del (map);
- return 0;
-}
diff --git a/runtime/tests/maps/iiss.c b/runtime/tests/maps/iiss.c
deleted file mode 100644
index 96369d56..00000000
--- a/runtime/tests/maps/iiss.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#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");
-
- /* delete */
- _stp_map_set_iiss (map, -9,-10,"Nevada", 0);
- _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
-
- /* should add nothing */
- _stp_map_set_iiss(map, 0,0,"", "");
- _stp_map_print (map, "map[%1d, %2d, %3s] = %s");
-
- _stp_map_del (map);
- return 0;
-}
diff --git a/runtime/tests/maps/is.c b/runtime/tests/maps/is.c
deleted file mode 100644
index 3008f702..00000000
--- a/runtime/tests/maps/is.c
+++ /dev/null
@@ -1,119 +0,0 @@
-#include "runtime.h"
-
-/* test of maps with keys of int64 and value of string */
-#define KEY1_TYPE INT64
-#define VALUE_TYPE STRING
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- MAP map = _stp_map_new_is(4);
- map->wrap = 1;
-
- /* map[1] = one */
- _stp_map_set_is (map, 1, "one");
-
- printf ("map[1]=%s\n", _stp_map_get_is(map,1));
- _stp_map_print(map,"map[%1d] = %s");
-
- /* map[3] = "three" */
- _stp_map_set_is (map, 3, "three");
- _stp_map_print(map,"map[%1d] = %s");
-
- /* now try to confuse things */
- /* These won't do anything useful, but shouldn't crash */
- _stp_map_set_is(0,1,"foobar");
- _stp_map_set_is(map,0,0);
- _stp_map_set_is(map,100,0);
- _stp_map_print(map,"map[%1d] = %s");
-
- /* create and delete a key */
- _stp_map_set_is (map, 1024, "2048");
- _stp_map_set_is (map, 1024, 0);
- _stp_map_print(map,"map[%1d] = %s");
-
- /* create and delete a key again*/
- _stp_map_set_is (map, 1024, "2048");
- _stp_map_print(map,"map[%1d] = %s");
- _stp_map_set_is (map, 1024, 0);
- _stp_map_print(map,"map[%1d] = %s");
-
-
- /* check that unset values are "" */
- if (*_stp_map_get_is(map, 5))
- printf("ERROR: unset key has nonempty value\n");
-
- /* map[5] = "five" */
- _stp_map_set_is (map, 5, "five");
- _stp_map_print(map,"map[%1d] = %s");
-
- /* test empty string (should delete)*/
- _stp_map_set_is (map, 5, "");
- _stp_map_print(map,"map[%1d] = %s");
-
-
- /* add 4 new entries, pushing the others out */
- int i;
- for (i = 6; i < 10; i++)
- {
- char buf[32];
- sprintf(buf, "value of %d", i);
- _stp_map_set_is (map, i, buf);
- }
- _stp_map_print(map,"map[%1d] = %s");
-
- /* 5, 382, 526, and 903 all hash to the same value (23) */
- /* use them to test the hash chain */
- _stp_map_set_is (map, 5, "1005");
- _stp_map_set_is (map, 382, "1382");
- _stp_map_set_is (map, 526, "1526");
- _stp_map_set_is (map, 903, "1903");
-
- _stp_map_print(map,"map[%1d] = %s");
-
- /* now delete all 4 nodes, one by one */
- _stp_map_set_is (map, 382, 0);
- _stp_map_print(map,"map[%1d] = %s");
-
- _stp_map_set_is (map, 5, 0);
- _stp_map_print(map,"map[%1d] = %s");
-
- _stp_map_set_is (map, 903, 0);
- _stp_map_print(map,"map[%1d] = %s");
-
- _stp_map_set_is (map, 526, 0);
- _stp_map_print(map,"map[%1d] = %s");
-
- /* test overflow errors */
- map->wrap = 0;
- for (i = 6; i < 10; i++)
- {
- char buf[32];
- sprintf(buf, "value of %d", i);
- _stp_map_set_is (map, i, buf);
- }
-
- for (i = 6; i < 10; i++)
- {
- char buf[32];
- int res;
- sprintf(buf, "new value of %d", i);
- res = _stp_map_set_is (map, i, buf);
- if (res)
- printf("WARNING: During wrap test, got result of %d when expected 0\n", res);
- }
- for (i = 16; i < 20; i++)
- {
- char buf[32];
- int res;
- sprintf(buf, "BAD value of %d", i);
- res = _stp_map_set_is (map, i, buf);
- if (res != -1)
- printf("WARNING: During wrap test, got result of %d when expected -1\n", res);
- }
- _stp_map_print(map,"map[%1d] = %s");
- _stp_map_del (map);
- return 0;
-}
diff --git a/runtime/tests/maps/issii.c b/runtime/tests/maps/issii.c
deleted file mode 100644
index 4861428a..00000000
--- a/runtime/tests/maps/issii.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#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/isx.c b/runtime/tests/maps/isx.c
deleted file mode 100644
index 9003f522..00000000
--- a/runtime/tests/maps/isx.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "runtime.h"
-
-/* test of maps with keys of int64 and value of stat */
-#define VALUE_TYPE STAT
-#define KEY1_TYPE INT64
-#include "map-gen.c"
-#include "map.c"
-
-int main ()
-{
- int i, j;
- MAP map = _stp_map_new_ix (4, HIST_LINEAR, 0, 100, 10 );
- MAP map2 = _stp_map_new_ix(4, HIST_LOG, 11);
-
- for (i = 0; i < 100; i++)
- for (j = 0; j <= i*10 ; j++ )
- _stp_map_add_ix (map, 3, i);
-
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10 ; j++ )
- _stp_map_add_ix (map, 2, j * i );
-
- for (i = 0; i < 100; i += 10)
- for (j = 0; j < i/10 ; j++ )
- _stp_map_add_ix (map, 1, i);
-
- for (i = 0; i < 128; i++)
- for (j = 0; j < 128 ; j++ )
- _stp_map_add_ix (map2, 1, i);
-
- for (i = 0; i < 1024; i++)
- for (j = 0; j < 1024 ; j++ )
- _stp_map_add_ix (map2, 2, i);
-
- _stp_map_print (map, "map[%1d] = count:%C sum:%S avg:%A min:%m max:%M\n%H");
- _stp_map_print (map2, "map2[%1d] = count:%C sum:%S avg:%A min:%m max:%M\n%H");
-
- _stp_map_del (map);
- _stp_map_del (map2);
- return 0;
-}
diff --git a/runtime/tests/maps/map.test b/runtime/tests/maps/map.test
deleted file mode 100644
index 51feca41..00000000
--- a/runtime/tests/maps/map.test
+++ /dev/null
@@ -1,999 +0,0 @@
-package require tcltest
-namespace import -force tcltest::*
-
-cd $tcltest::testsDirectory
-
-set CFLAGS "-Os"
-set KPATH "/lib/modules/[exec uname -r]/build/include"
-set MPATH "/lib/modules/[exec uname -r]/build/include/asm/mach-default"
-set PATH "../../user"
-
-test isx {Test of int64 keys and stat values} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test isx.c
-} -body {
- exec ./test
-} -result {map[3] = count:49600 sum:3288450 avg:66 min:0 max:99
-value |-------------------------------------------------- count
- 0 |@@ 460
- 10 |@@@@@@@ 1460
- 20 |@@@@@@@@@@@@ 2460
- 30 |@@@@@@@@@@@@@@@@@@ 3460
- 40 |@@@@@@@@@@@@@@@@@@@@@@@ 4460
- 50 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5460
- 60 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6460
- 70 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7460
- 80 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8460
- 90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9460
-
-map[2] = count:100 sum:2025 avg:20 min:0 max:81
-value |-------------------------------------------------- count
- 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 42
- 10 |@@@@@@@@@@@@@@@@@ 17
- 20 |@@@@@@@@@@@@@ 13
- 30 |@@@@@@@@@ 9
- 40 |@@@@@@@@@ 9
- 50 |@@@@ 4
- 60 |@@@ 3
- 70 |@@ 2
- 80 |@ 1
- 90 | 0
-
-map[1] = count:45 sum:2850 avg:63 min:10 max:90
-value |-------------------------------------------------- count
- 0 | 0
- 10 |@ 1
- 20 |@@ 2
- 30 |@@@ 3
- 40 |@@@@ 4
- 50 |@@@@@ 5
- 60 |@@@@@@ 6
- 70 |@@@@@@@ 7
- 80 |@@@@@@@@ 8
- 90 |@@@@@@@@@ 9
-
-
-map2[1] = count:16384 sum:1040384 avg:63 min:0 max:127
-value |-------------------------------------------------- count
- 0 | 128
- 1 | 128
- 2 |@ 256
- 4 |@@@ 512
- 8 |@@@@@@ 1024
- 16 |@@@@@@@@@@@@ 2048
- 32 |@@@@@@@@@@@@@@@@@@@@@@@@ 4096
- 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8192
- 128 | 0
- 256 | 0
-
-map2[2] = count:1048576 sum:536346624 avg:511 min:0 max:1023
-value |-------------------------------------------------- count
- 0 | 1024
- 1 | 1024
- 2 | 2048
- 4 | 4096
- 8 | 8192
- 16 |@ 16384
- 32 |@@@ 32768
- 64 |@@@@@@ 65536
- 128 |@@@@@@@@@@@@ 131072
- 256 |@@@@@@@@@@@@@@@@@@@@@@@@ 262144
- 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 524288
-
-}
-
-
-test map_format {Torture test of map formatting} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test map_format.c
-} -body {
- exec ./test
-} -result {Columbus -> mapiis 1 2 Ohio
-Sacramento -> mapiis 3 4 California
-Olympia -> mapiis 5 6 Washington
-Salem -> mapiis 7 8 Oregon
-
-Columbus % Ohio
-Sacramento % California
-Olympia % Washington
-Salem % Oregon
-
-Columbus -> mapiis
-Sacramento -> mapiis
-Olympia -> mapiis
-Salem -> mapiis
-
-The capitol of Riga is Latvia and the nerd population is 212063400820736
-The capitol of Sofia is Bulgaria and the nerd population is -2400999087387945352
-The capitol of Valletta is Malta and the nerd population is 1
-The capitol of Nicosia is Cyprus and the nerd population is -1
-
-The capitol of Riga is Latvia and the nerd population is c0dedbad0000
-The capitol of Sofia is Bulgaria and the nerd population is deadf00d12345678
-The capitol of Valletta is Malta and the nerd population is 1
-The capitol of Nicosia is Cyprus and the nerd population is ffffffffffffffff
-
-The capitol of Riga is Latvia and the nerd population is C0DEDBAD0000
-The capitol of Sofia is Bulgaria and the nerd population is DEADF00D12345678
-The capitol of Valletta is Malta and the nerd population is 1
-The capitol of Nicosia is Cyprus and the nerd population is FFFFFFFFFFFFFFFF
-
-Bogons per packet for Riga
-count:49600 sum:3288450 avg:66 min:0 max:99
-value |-------------------------------------------------- count
- 0 |@@ 460
- 10 |@@@@@@@ 1460
- 20 |@@@@@@@@@@@@ 2460
- 30 |@@@@@@@@@@@@@@@@@@ 3460
- 40 |@@@@@@@@@@@@@@@@@@@@@@@ 4460
- 50 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5460
- 60 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6460
- 70 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7460
- 80 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8460
- 90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9460
-
-Bogons per packet for Sofia
-count:100 sum:2025 avg:20 min:0 max:81
-value |-------------------------------------------------- count
- 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 42
- 10 |@@@@@@@@@@@@@@@@@ 17
- 20 |@@@@@@@@@@@@@ 13
- 30 |@@@@@@@@@ 9
- 40 |@@@@@@@@@ 9
- 50 |@@@@ 4
- 60 |@@@ 3
- 70 |@@ 2
- 80 |@ 1
- 90 | 0
-
-Bogons per packet for Valletta
-count:45 sum:2850 avg:63 min:10 max:90
-value |-------------------------------------------------- count
- 0 | 0
- 10 |@ 1
- 20 |@@ 2
- 30 |@@@ 3
- 40 |@@@@ 4
- 50 |@@@@@ 5
- 60 |@@@@@@ 6
- 70 |@@@@@@@ 7
- 80 |@@@@@@@@ 8
- 90 |@@@@@@@@@ 9
-
-
-49600 was the count for Riga, Latvia
-100 was the count for Sofia, Bulgaria
-45 was the count for Valletta, Malta
-
-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
-}
-
-test map_sort {Test of sorting} -setup {
- puts "gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test sort.c"
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test sort.c
-} -body {
- exec ./test
-} -result {sorting from A-Z on value
-Boston -> 5 5 Massachusetts
-Carson City -> 7 8 Nevada
-Columbus -> 1 2 Ohio
-Des Moines -> 8 8 Iowa
-Montpelier -> 2 2 Vermont
-Olympia -> 5 6 Washington
-Raleigh -> -1 9 North Carolina
-Sacramento -> 3 4 California
-Salem -> 7 8 Oregon
-Santa Fe -> 1 4 New Mexico
-
-
-sorting from Z-A on value
-Santa Fe -> 1 4 New Mexico
-Salem -> 7 8 Oregon
-Sacramento -> 3 4 California
-Raleigh -> -1 9 North Carolina
-Olympia -> 5 6 Washington
-Montpelier -> 2 2 Vermont
-Des Moines -> 8 8 Iowa
-Columbus -> 1 2 Ohio
-Carson City -> 7 8 Nevada
-Boston -> 5 5 Massachusetts
-
-
-sorting from low to high on key 1
--1 9 North Carolina -> Raleigh
-1 4 New Mexico -> Santa Fe
-1 2 Ohio -> Columbus
-2 2 Vermont -> Montpelier
-3 4 California -> Sacramento
-5 6 Washington -> Olympia
-5 5 Massachusetts -> Boston
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
-8 8 Iowa -> Des Moines
-
-
-sorting from high to low on key 1
-8 8 Iowa -> Des Moines
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
-5 6 Washington -> Olympia
-5 5 Massachusetts -> Boston
-3 4 California -> Sacramento
-2 2 Vermont -> Montpelier
-1 4 New Mexico -> Santa Fe
-1 2 Ohio -> Columbus
--1 9 North Carolina -> Raleigh
-
-
-sorting from low to high on key 2
-2 2 Vermont -> Montpelier
-1 2 Ohio -> Columbus
-3 4 California -> Sacramento
-1 4 New Mexico -> Santa Fe
-5 5 Massachusetts -> Boston
-5 6 Washington -> Olympia
-8 8 Iowa -> Des Moines
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
--1 9 North Carolina -> Raleigh
-
-
-sorting from high to low on key 2
--1 9 North Carolina -> Raleigh
-8 8 Iowa -> Des Moines
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
-5 6 Washington -> Olympia
-5 5 Massachusetts -> Boston
-3 4 California -> Sacramento
-1 4 New Mexico -> Santa Fe
-2 2 Vermont -> Montpelier
-1 2 Ohio -> Columbus
-
-
-sorting from low to high on key 3
-California 3 4 -> Sacramento
-Iowa 8 8 -> Des Moines
-Massachusetts 5 5 -> Boston
-Nevada 7 8 -> Carson City
-New Mexico 1 4 -> Santa Fe
-North Carolina -1 9 -> Raleigh
-Ohio 1 2 -> Columbus
-Oregon 7 8 -> Salem
-Vermont 2 2 -> Montpelier
-Washington 5 6 -> Olympia
-
-
-sorting from high to low on key 3
-Washington 5 6 -> Olympia
-Vermont 2 2 -> Montpelier
-Oregon 7 8 -> Salem
-Ohio 1 2 -> Columbus
-North Carolina -1 9 -> Raleigh
-New Mexico 1 4 -> Santa Fe
-Nevada 7 8 -> Carson City
-Massachusetts 5 5 -> Boston
-Iowa 8 8 -> Des Moines
-California 3 4 -> Sacramento
-
-
-top 3 alphabetical by value
-Boston -> 5 5 Massachusetts
-Carson City -> 7 8 Nevada
-Columbus -> 1 2 Ohio
-
-
-bottom 2 alphabetical by value
-Santa Fe -> 1 4 New Mexico
-Salem -> 7 8 Oregon
-
-
-top 5 sorted by key 1
-8 8 Iowa -> Des Moines
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
-5 6 Washington -> Olympia
-5 5 Massachusetts -> Boston
-
-
-bottom 5 sorted by key 1
--1 9 North Carolina -> Raleigh
-1 4 New Mexico -> Santa Fe
-1 2 Ohio -> Columbus
-2 2 Vermont -> Montpelier
-3 4 California -> Sacramento
-
-sorted by population from low to high
-Nicosia is the capitol of Cyprus and the nerd population is -1
-Valletta is the capitol of Malta and the nerd population is 1
-Riga is the capitol of Latvia and the nerd population is 135786
-Sofia is the capitol of Bulgaria and the nerd population is 138740
-
-sorted by population from high to low
-Sofia is the capitol of Bulgaria and the nerd population is 138740
-Riga is the capitol of Latvia and the nerd population is 135786
-Valletta is the capitol of Malta and the nerd population is 1
-Nicosia is the capitol of Cyprus and the nerd population is -1
-}
-
-test ii {Test of int64 keys and int64 values} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ii.c
-} -body {
- exec ./test
-} -result {map[1]=2
-map[1] = 2
-map[3] = 4
-
-map[1] = 2
-map[3] = 4
-
-0 (should be 0)
-map[1] = 2
-map[3] = 4
-map[5] = 6
-
-map[6] = 106
-map[7] = 107
-map[8] = 108
-map[9] = 109
-
-map[5] = 1005
-map[382] = 1382
-map[526] = 1526
-map[903] = 1903
-
-map[5] = 1005
-map[526] = 1526
-map[903] = 1903
-
-map[526] = 1526
-map[903] = 1903
-
-map[526] = 1526
-
-
-map[33] = 3333
-map[44] = 4444
-map[55] = 5555
-map[66] = 6666
-
-
-map[1970] = 1799
-}
-
-test is {Test of int64 keys and string values} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test is.c
-} -body {
- exec ./test
-} -result {map[1]=one
-map[1] = one
-
-map[1] = one
-map[3] = three
-
-map[1] = one
-map[3] = three
-
-map[1] = one
-map[3] = three
-
-map[1] = one
-map[3] = three
-map[1024] = 2048
-
-map[1] = one
-map[3] = three
-
-map[1] = one
-map[3] = three
-map[5] = five
-
-map[1] = one
-map[3] = three
-
-map[6] = value of 6
-map[7] = value of 7
-map[8] = value of 8
-map[9] = value of 9
-
-map[5] = 1005
-map[382] = 1382
-map[526] = 1526
-map[903] = 1903
-
-map[5] = 1005
-map[526] = 1526
-map[903] = 1903
-
-map[526] = 1526
-map[903] = 1903
-
-map[526] = 1526
-
-
-map[6] = new value of 6
-map[7] = new value of 7
-map[8] = new value of 8
-map[9] = new value of 9
-}
-
-test si {Test of string keys and int64 values} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test si.c
-} -body {
- exec ./test
-} -result {map[Ohio]=1
-map[Ohio] = 1
-
-map[Ohio] = 1
-map[Washington] = 2
-
-map[Ohio] = 1
-map[Washington] = 2
-
-map[Ohio] = 1
-map[Washington] = 2
-map[1024] = 2048
-
-map[Ohio] = 1
-map[Washington] = 2
-
-map[Ohio] = 1
-map[Washington] = 2
-map[1024] = 2048
-
-map[Ohio] = 1
-map[Washington] = 2
-
-map[Ohio] = 1
-map[Washington] = 2
-map[California] = 3
-
-map[Ohio] = 1
-map[Washington] = 2
-map[California] = 3
-map[] = 7777
-
-map[Ohio] = 1
-map[Washington] = 2
-map[California] = 3
-map[] = 8888
-
-map[Ohio] = 1
-map[Washington] = 2
-map[California] = 3
-
-map[String 6] = 106
-map[String 7] = 107
-map[String 8] = 108
-map[String 9] = 109
-
-map[String 6] = 106
-map[String 7] = 107
-map[String 8] = 108
-map[String 9] = 109
-
-map[String 6] = 6106
-map[String 7] = 7107
-map[String 8] = 8108
-map[String 9] = 9109
-
-map[String 6] = 6
-map[String 7] = 7
-map[String 8] = 8
-map[String 9] = 9
-
-}
-
-test iiss {Test of int64,int64,string keys and string values} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test iiss.c
-} -body {
- exec ./test
-} -result {map[1, 2, Ohio] = Columbus
-map[3, 4, California] = Sacramento
-map[5, 6, Washington] = Seattle
-map[7, 8, Oregon] = Salem
-
-map[3, 4, California] = Sacramento
-map[5, 6, Washington] = Seattle
-map[7, 8, Oregon] = Salem
-map[-9, -10, Nevada] = Carson City
-
-map[3, 4, California] = Sacramento
-map[5, 6, Washington] = Olymp
-map[7, 8, Oregon] = Salem
-map[-9, -10, Nevada] = Carson City
-
-map[3, 4, California] = Sacramento
-map[5, 6, Washington] = Olympis
-map[7, 8, Oregon] = Salem
-map[-9, -10, Nevada] = Carson City
-
-map[3, 4, California] = Sacramento
-map[5, 6, Washington] = Olympia
-map[7, 8, Oregon] = Salem
-map[-9, -10, Nevada] = Carson City
-
-map[3, 4, California] = Sacramento
-map[5, 6, Washington] = Olympia
-map[7, 8, Oregon] = Salem
-
-map[3, 4, California] = Sacramento
-map[5, 6, Washington] = Olympia
-map[7, 8, Oregon] = Salem
-}
-
-test setadd {Test of setting and adding values} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test setadd.c
-} -body {
- exec ./test
-} -result {mapi[1] = 1
-mapi[2] = 4
-mapi[3] = 9
-mapi[4] = 16
-
-maps[1] = value of 1
-maps[2] = value of 2
-maps[3] = value of 3
-maps[4] = value of 4
-
-mapx[1] = count:1 sum:1 avg:1 min:1 max:1
-mapx[2] = count:1 sum:2 avg:2 min:2 max:2
-mapx[3] = count:1 sum:3 avg:3 min:3 max:3
-mapx[4] = count:1 sum:4 avg:4 min:4 max:4
-
-mapi[1] = 2
-mapi[2] = 8
-mapi[3] = 18
-mapi[4] = 32
-
-maps[1] = value of 1*****
-maps[2] = value of 2*****
-maps[3] = value of 3*****
-maps[4] = value of 4*****
-
-mapx[1] = count:2 sum:3 avg:1 min:1 max:2
-mapx[2] = count:2 sum:6 avg:3 min:2 max:4
-mapx[3] = count:2 sum:9 avg:4 min:3 max:6
-mapx[4] = count:2 sum:12 avg:6 min:4 max:8
-
-Adding 0
-mapi[1] = 2
-mapi[2] = 8
-mapi[3] = 18
-mapi[4] = 32
-
-maps[1] = value of 1*****
-maps[2] = value of 2*****
-maps[3] = value of 3*****
-maps[4] = value of 4*****
-
-maps[1] = value of 1*****
-maps[2] = value of 2*****
-maps[3] = value of 3*****
-maps[4] = value of 4*****
-
-mapx[1] = count:3 sum:3 avg:1 min:0 max:2
-mapx[2] = count:3 sum:6 avg:2 min:0 max:4
-mapx[3] = count:3 sum:9 avg:3 min:0 max:6
-mapx[4] = count:3 sum:12 avg:4 min:0 max:8
-
-Add 'X' to strings
-maps[1] = value of 1*****X
-maps[2] = value of 2*****X
-maps[3] = value of 3*****X
-maps[4] = value of 4*****X
-
-setting everything to 0
-
-
-
-
-Adding 0
-
-
-
-mapx[1] = count:1 sum:0 avg:0 min:0 max:0
-mapx[2] = count:1 sum:0 avg:0 min:0 max:0
-mapx[3] = count:1 sum:0 avg:0 min:0 max:0
-mapx[4] = count:1 sum:0 avg:0 min:0 max:0
-
-setting everything to -1
-mapi[1] = -1
-mapi[2] = -1
-mapi[3] = -1
-mapi[4] = -1
-
-mapx[1] = count:1 sum:-1 avg:-1 min:-1 max:-1
-mapx[2] = count:1 sum:-1 avg:-1 min:-1 max:-1
-mapx[3] = count:1 sum:-1 avg:-1 min:-1 max:-1
-mapx[4] = count:1 sum:-1 avg:-1 min:-1 max:-1
-
-adding -1
-mapi[1] = -2
-mapi[2] = -2
-mapi[3] = -2
-mapi[4] = -2
-
-mapx[1] = count:2 sum:-2 avg:-1 min:-1 max:-1
-mapx[2] = count:2 sum:-2 avg:-1 min:-1 max:-1
-mapx[3] = count:2 sum:-2 avg:-1 min:-1 max:-1
-mapx[4] = count:2 sum:-2 avg:-1 min:-1 max:-1
-}
-
-test iiiiii {Test of 5 int keys and an int value} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test iiiiii.c
-} -body {
- exec ./test
-} -result {map[1, 2, 3, 4, 5] = 10
-map[10, 20, 30, 40, 50] = 100
-map[-1, -2, -3, -4, -5] = -10
-map[100, 200, 300, 400, 500] = 1000
-1 - 2 - 3 - 4 - 5 *** 10
-10 - 20 - 30 - 40 - 50 *** 100
--1 - -2 - -3 - -4 - -5 *** -10
-100 - 200 - 300 - 400 - 500 *** 1000
-}
-
-test ssssss {Test of 5 string keys and a string value} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ssssss.c
-} -body {
- exec ./test
-} -result {map[1ABC, 2ABC, 3ABC, 4ABC, 5ABC] = 666
-map[1QRS, 2QRS, 3QRS, 4QRS, 5QRS] = 777
-map[1abc, 2abc, 3abc, 4abc, 5abc] = 888
-map[1XYZ, 2XYZ, 3XYZ, 4XYZ, 5XYZ] = 999
-1ABC and 2ABC and 3ABC and 4ABC and 5ABC ---> 666
-1QRS and 2QRS and 3QRS and 4QRS and 5QRS ---> 777
-1abc and 2abc and 3abc and 4abc and 5abc ---> 888
-1XYZ and 2XYZ and 3XYZ and 4XYZ and 5XYZ ---> 999
-}
-
-test sort_stat {Test of sorting stats} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test sort_stat.c
-} -body {
- exec ./test
-} -result {Bogons per packet for California
-count:49600 sum:3288450 avg:66 min:0 max:99
-value |-------------------------------------------------- count
- 0 |@@ 460
- 10 |@@@@@@@ 1460
- 20 |@@@@@@@@@@@@ 2460
- 30 |@@@@@@@@@@@@@@@@@@ 3460
- 40 |@@@@@@@@@@@@@@@@@@@@@@@ 4460
- 50 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5460
- 60 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6460
- 70 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7460
- 80 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8460
- 90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9460
-
-Bogons per packet for Washington
-count:100 sum:2025 avg:20 min:0 max:81
-value |-------------------------------------------------- count
- 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 42
- 10 |@@@@@@@@@@@@@@@@@ 17
- 20 |@@@@@@@@@@@@@ 13
- 30 |@@@@@@@@@ 9
- 40 |@@@@@@@@@ 9
- 50 |@@@@ 4
- 60 |@@@ 3
- 70 |@@ 2
- 80 |@ 1
- 90 | 0
-
-Bogons per packet for Oregon
-count:90 sum:5700 avg:63 min:10 max:90
-value |-------------------------------------------------- count
- 0 | 0
- 10 |@@ 2
- 20 |@@@@ 4
- 30 |@@@@@@ 6
- 40 |@@@@@@@@ 8
- 50 |@@@@@@@@@@ 10
- 60 |@@@@@@@@@@@@ 12
- 70 |@@@@@@@@@@@@@@ 14
- 80 |@@@@@@@@@@@@@@@@ 16
- 90 |@@@@@@@@@@@@@@@@@@ 18
-
-Bogons per packet for Nevada
-count:45 sum:2970 avg:66 min:10 max:98
-value |-------------------------------------------------- count
- 0 | 0
- 10 |@ 1
- 20 |@@ 2
- 30 |@@@ 3
- 40 |@@@@ 4
- 50 |@@@@@ 5
- 60 |@@@@@@ 6
- 70 |@@@@@@@ 7
- 80 |@@@@@@@@ 8
- 90 |@@@@@@@@@ 9
-
-Bogons per packet for Ohio
-count:20 sum:1000 avg:50 min:50 max:50
-value |-------------------------------------------------- count
- 30 | 0
- 40 | 0
- 50 |@@@@@@@@@@@@@@@@@@@@ 20
- 60 | 0
- 70 | 0
-
-Bogons per packet for North Carolina
-count:45 sum:-4200 avg:-93 min:-620 max:100
-value |-------------------------------------------------- count
- 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 26
- 10 |@ 1
- 20 |@@ 2
- 30 |@ 1
- 40 |@@ 2
- 50 |@ 1
- 60 |@ 1
- 70 |@ 1
- 80 |@ 1
- 90 |@@@@@@@@@ 9
-
-Bogons per packet for New Mexico
-count:450 sum:8475 avg:18 min:-39 max:50
-value |-------------------------------------------------- count
- 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 145
- 10 |@@@@@@@@@@@@@@@@@@@ 59
- 20 |@@@@@@@@@@@@@@@@@@@@@@@ 69
- 30 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 79
- 40 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 89
- 50 |@@@ 9
- 60 | 0
- 70 | 0
-
-
-SORTED BY COUNT
-49600 California
-450 New Mexico
-100 Washington
-90 Oregon
-45 Nevada
-45 North Carolina
-20 Ohio
-
-SORTED BY COUNT (low to high)
-20 Ohio
-45 Nevada
-45 North Carolina
-90 Oregon
-100 Washington
-450 New Mexico
-49600 California
-
-SORTED BY SUM
-3288450 California
-8475 New Mexico
-5700 Oregon
-2970 Nevada
-2025 Washington
-1000 Ohio
--4200 North Carolina
-
-SORTED BY SUM (low to high)
--4200 North Carolina
-1000 Ohio
-2025 Washington
-2970 Nevada
-5700 Oregon
-8475 New Mexico
-3288450 California
-
-SORTED BY MIN
-50 Ohio
-10 Nevada
-10 Oregon
-0 Washington
-0 California
--39 New Mexico
--620 North Carolina
-
-SORTED BY MIN (low to high)
--620 North Carolina
--39 New Mexico
-0 Washington
-0 California
-10 Nevada
-10 Oregon
-50 Ohio
-
-SORTED BY MAX
-100 North Carolina
-99 California
-98 Nevada
-90 Oregon
-81 Washington
-50 New Mexico
-50 Ohio
-
-SORTED BY MAX (low to high)
-50 New Mexico
-50 Ohio
-81 Washington
-90 Oregon
-98 Nevada
-99 California
-100 North Carolina
-
-SORTED BY AVG
-66 Nevada
-66 California
-63 Oregon
-50 Ohio
-20 Washington
-18 New Mexico
--93 North Carolina
-
-SORTED BY AVG (low to high)
--93 North Carolina
-18 New Mexico
-20 Washington
-50 Ohio
-63 Oregon
-66 Nevada
-66 California
-}
-
-test sort2 {Test of sorting (odd number of elements)} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test sort2.c
-} -body {
- exec ./test
-} -result {sorting from A-Z on value
-Boston -> 5 5 Massachusetts
-Carson City -> 7 8 Nevada
-Columbus -> 1 2 Ohio
-Des Moines -> 8 8 Iowa
-Olympia -> 5 6 Washington
-Raleigh -> -1 9 North Carolina
-Sacramento -> 3 4 California
-Salem -> 7 8 Oregon
-Santa Fe -> 1 4 New Mexico
-
-
-sorting from Z-A on value
-Santa Fe -> 1 4 New Mexico
-Salem -> 7 8 Oregon
-Sacramento -> 3 4 California
-Raleigh -> -1 9 North Carolina
-Olympia -> 5 6 Washington
-Des Moines -> 8 8 Iowa
-Columbus -> 1 2 Ohio
-Carson City -> 7 8 Nevada
-Boston -> 5 5 Massachusetts
-
-
-sorting from low to high on key 1
--1 9 North Carolina -> Raleigh
-1 4 New Mexico -> Santa Fe
-1 2 Ohio -> Columbus
-3 4 California -> Sacramento
-5 6 Washington -> Olympia
-5 5 Massachusetts -> Boston
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
-8 8 Iowa -> Des Moines
-
-
-sorting from high to low on key 1
-8 8 Iowa -> Des Moines
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
-5 6 Washington -> Olympia
-5 5 Massachusetts -> Boston
-3 4 California -> Sacramento
-1 4 New Mexico -> Santa Fe
-1 2 Ohio -> Columbus
--1 9 North Carolina -> Raleigh
-
-
-sorting from low to high on key 2
-1 2 Ohio -> Columbus
-3 4 California -> Sacramento
-1 4 New Mexico -> Santa Fe
-5 5 Massachusetts -> Boston
-5 6 Washington -> Olympia
-8 8 Iowa -> Des Moines
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
--1 9 North Carolina -> Raleigh
-
-
-sorting from high to low on key 2
--1 9 North Carolina -> Raleigh
-8 8 Iowa -> Des Moines
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
-5 6 Washington -> Olympia
-5 5 Massachusetts -> Boston
-3 4 California -> Sacramento
-1 4 New Mexico -> Santa Fe
-1 2 Ohio -> Columbus
-
-
-sorting from low to high on key 3
-California 3 4 -> Sacramento
-Iowa 8 8 -> Des Moines
-Massachusetts 5 5 -> Boston
-Nevada 7 8 -> Carson City
-New Mexico 1 4 -> Santa Fe
-North Carolina -1 9 -> Raleigh
-Ohio 1 2 -> Columbus
-Oregon 7 8 -> Salem
-Washington 5 6 -> Olympia
-
-
-sorting from high to low on key 3
-Washington 5 6 -> Olympia
-Oregon 7 8 -> Salem
-Ohio 1 2 -> Columbus
-North Carolina -1 9 -> Raleigh
-New Mexico 1 4 -> Santa Fe
-Nevada 7 8 -> Carson City
-Massachusetts 5 5 -> Boston
-Iowa 8 8 -> Des Moines
-California 3 4 -> Sacramento
-
-
-top 3 alphabetical by value
-Boston -> 5 5 Massachusetts
-Carson City -> 7 8 Nevada
-Columbus -> 1 2 Ohio
-
-
-bottom 2 alphabetical by value
-Santa Fe -> 1 4 New Mexico
-Salem -> 7 8 Oregon
-
-
-top 5 sorted by key 1
-8 8 Iowa -> Des Moines
-7 8 Oregon -> Salem
-7 8 Nevada -> Carson City
-5 6 Washington -> Olympia
-5 5 Massachusetts -> Boston
-
-
-bottom 5 sorted by key 1
--1 9 North Carolina -> Raleigh
-1 4 New Mexico -> Santa Fe
-1 2 Ohio -> Columbus
-3 4 California -> Sacramento
-5 6 Washington -> Olympia
-
-sorted by population from low to high
-Nicosia is the capitol of Cyprus and the nerd population is -1
-Valletta is the capitol of Malta and the nerd population is 1
-Chisinau is the capitol of Moldova and the nerd population is 1024
-Riga is the capitol of Latvia and the nerd population is 135786
-Sofia is the capitol of Bulgaria and the nerd population is 138740
-
-sorted by population from high to low
-Sofia is the capitol of Bulgaria and the nerd population is 138740
-Riga is the capitol of Latvia and the nerd population is 135786
-Chisinau is the capitol of Moldova and the nerd population is 1024
-Valletta is the capitol of Malta and the nerd population is 1
-Nicosia is the capitol of Cyprus and the nerd population is -1
-}
-
-
-test size {Test of _stp_map_size()} -setup {
- exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test size.c
-} -body {
- exec ./test
-} -result {}
-
-catch {exec rm test}
-
-cleanupTests
diff --git a/runtime/tests/maps/map_format.c b/runtime/tests/maps/map_format.c
deleted file mode 100644
index 184aa79a..00000000
--- a/runtime/tests/maps/map_format.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "runtime.h"
-
-/* torture test of map formatting */
-#define VALUE_TYPE STRING
-#define KEY1_TYPE INT64
-#define KEY2_TYPE INT64
-#define KEY3_TYPE STRING
-#include "map-gen.c"
-
-#define VALUE_TYPE INT64
-#define KEY1_TYPE STRING
-#define KEY2_TYPE STRING
-#include "map-gen.c"
-
-#define VALUE_TYPE STAT
-#define KEY1_TYPE STRING
-#define KEY2_TYPE STRING
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- MAP mapiis = _stp_map_new_iiss(4);
- _stp_map_set_iiss (mapiis, 1,2,"Ohio", "Columbus" );
- _stp_map_set_iiss (mapiis, 3,4,"California", "Sacramento" );
- _stp_map_set_iiss (mapiis, 5,6,"Washington", "Olympia" );
- _stp_map_set_iiss (mapiis, 7,8,"Oregon", "Salem" );
- _stp_map_print (mapiis, "%s -> mapiis %1d %2d %3s");
-
- /* test printing of '%' */
- _stp_map_print (mapiis, "%s %% %3s");
-
- /* very bad string. don't crash */
- _stp_map_print (mapiis, "%s -> mapiis %1s %2s %3d %4d");
-
- MAP mapss = _stp_map_new_ssi(4);
- _stp_map_set_ssi (mapss, "Riga", "Latvia", 0x0000c0dedbad0000LL);
- _stp_map_set_ssi (mapss, "Sofia", "Bulgaria", 0xdeadf00d12345678LL);
- _stp_map_set_ssi (mapss, "Valletta", "Malta", 1);
- _stp_map_set_ssi (mapss, "Nicosia", "Cyprus", -1);
- _stp_map_print (mapss, "The capitol of %1s is %2s and the nerd population is %d");
- _stp_map_print (mapss, "The capitol of %1s is %2s and the nerd population is %x");
- _stp_map_print (mapss, "The capitol of %1s is %2s and the nerd population is %X");
-
- MAP mapsst = _stp_map_new_ssx (4, HIST_LINEAR, 0, 100, 10 );
- int i,j;
-
- for (i = 0; i < 100; i++)
- for (j = 0; j <= i*10 ; j++ )
- _stp_map_add_ssx (mapsst, "Riga", "Latvia", i);
-
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10 ; j++ )
- _stp_map_add_ssx (mapsst, "Sofia", "Bulgaria", j * i );
-
- for (i = 0; i < 100; i += 10)
- for (j = 0; j < i/10 ; j++ )
- _stp_map_add_ssx (mapsst, "Valletta", "Malta", i);
-
- _stp_map_print (mapsst, "Bogons per packet for %1s\ncount:%C sum:%S avg:%A min:%m max:%M\n%H");
-
- _stp_map_print (mapsst, "%C was the count for %1s, %2s");
-
- /* here's how to print a map without using _stp_map_print(). */
- struct map_node *ptr;
- foreach (mapsst, ptr)
- _stp_printf ("mapsst[%09s,%09s] = %llX\n", key1str(ptr), key2str(ptr), _stp_get_stat(ptr)->sum);
- _stp_print_flush();
-
- return 0;
-}
diff --git a/runtime/tests/maps/setadd.c b/runtime/tests/maps/setadd.c
deleted file mode 100644
index 8eedbaa9..00000000
--- a/runtime/tests/maps/setadd.c
+++ /dev/null
@@ -1,245 +0,0 @@
-#include "runtime.h"
-
-/* verify correct set and add behavior */
-#define VALUE_TYPE INT64
-#define KEY1_TYPE INT64
-#define STP_MAP_II
-#include "map-gen.c"
-
-#define VALUE_TYPE STRING
-#define KEY1_TYPE INT64
-#include "map-gen.c"
-
-#define VALUE_TYPE STAT
-#define KEY1_TYPE INT64
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- int i, res;
- MAP mapi = _stp_map_new_ii(4);
- MAP maps = _stp_map_new_is(4);
- MAP mapx = _stp_map_new_ix(4, HIST_NONE);
-
- /* use add to set initial values */
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ii (mapi, i, i*i);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(mapi,"mapi[%1d] = %d");
-
- for (i = 1; i < 5; i++)
- {
- char buf[32];
- sprintf(buf, "value of %d", i);
- res = _stp_map_add_is (maps, i, buf);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ix (mapx, i, i);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print (mapx, "mapx[%1d] = count:%C sum:%S avg:%A min:%m max:%M");
-
- /*************** now add some values *******************/
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ii (mapi, i, i*i);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(mapi,"mapi[%1d] = %d");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_is (maps, i, "*****");
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ix (mapx, i, i+i);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print (mapx, "mapx[%1d] = count:%C sum:%S avg:%A min:%m max:%M");
-
- /*************** now add 0 *******************/
- printf ("Adding 0\n");
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ii (mapi, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(mapi,"mapi[%1d] = %d");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_is (maps, i, "");
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- /* adding NULL should be same as adding "" for string values */
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_is (maps, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ix (mapx, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print (mapx, "mapx[%1d] = count:%C sum:%S avg:%A min:%m max:%M");
-
- /*************** now add X to strings *******************/
- printf ("Add 'X' to strings\n");
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_is (maps, i, "X");
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- /*************** now set to 0 (clear) *******************/
- printf ("setting everything to 0\n");
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_set_ii (mapi, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(mapi,"mapi[%1d] = %d");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_set_is (maps, i, "");
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- /* set it back to something */
- for (i = 1; i < 5; i++)
- {
- char buf[32];
- sprintf(buf, "%d", i);
- res = _stp_map_set_is (maps, i, buf);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
-
- /* setting to NULL also deletes */
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_set_is (maps, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_set_ix (mapx, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print (mapx, "mapx[%1d] = count:%C sum:%S avg:%A min:%m max:%M");
-
- /*************** now add 0 *******************/
- printf ("Adding 0\n");
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ii (mapi, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(mapi,"mapi[%1d] = %d");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_is (maps, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_is (maps, i, "");
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(maps,"maps[%1d] = %s");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ix (mapx, i, 0);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print (mapx, "mapx[%1d] = count:%C sum:%S avg:%A min:%m max:%M");
-
-
- /*************** now set to -1 *******************/
- printf ("setting everything to -1\n");
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_set_ii (mapi, i, -1);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(mapi,"mapi[%1d] = %d");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_set_ix (mapx, i, -1);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print (mapx, "mapx[%1d] = count:%C sum:%S avg:%A min:%m max:%M");
-
- /*************** now add -1 *******************/
- printf ("adding -1\n");
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ii (mapi, i, -1);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print(mapi,"mapi[%1d] = %d");
-
- for (i = 1; i < 5; i++)
- {
- res = _stp_map_add_ix (mapx, i, -1);
- if (res)
- printf("ERROR: got result of %d when expected 0\n", res);
- }
- _stp_map_print (mapx, "mapx[%1d] = count:%C sum:%S avg:%A min:%m max:%M");
-
-
- _stp_map_del (mapi);
- _stp_map_del (maps);
- _stp_map_del (mapx);
- return 0;
-}
diff --git a/runtime/tests/maps/si.c b/runtime/tests/maps/si.c
deleted file mode 100644
index d9db65d7..00000000
--- a/runtime/tests/maps/si.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include "runtime.h"
-
-/* test of maps with keys of string and value of int64 */
-#define VALUE_TYPE INT64
-#define KEY1_TYPE STRING
-#include "map-gen.c"
-#include "map.c"
-
-int main ()
-{
- int res;
- MAP map = _stp_map_new_si(4);
- map->wrap = 1;
-
- /* map[Ohio] = 1 */
- _stp_map_set_si (map, "Ohio", 1);
- printf ("map[Ohio]=%lld\n", _stp_map_get_si(map,"Ohio"));
- _stp_map_print(map,"map[%1s] = %d");
-
- /* map[Washington] = 2 */
- _stp_map_set_si (map, "Washington", 2);
- _stp_map_print (map, "map[%1s] = %d");
-
- /* now try to confuse things */
- /* These won't do anything useful, but shouldn't crash */
-
- /* bad map */
- res = _stp_map_set_si(0,"foo",100);
- if (res != -2)
- printf("WARNING: got result of %d when expected -2\n", res);
-
- /* bad key */
- res = _stp_map_set_si(map,0,0);
- if (res != -2)
- printf("WARNING: got result of %d when expected -2\n", res);
-
- /* bad key */
- res = _stp_map_set_si(map,0,42);
- if (res != -2)
- printf("WARNING: got result of %d when expected -2\n", res);
-
- res = _stp_map_set_si(map,"",0);
- if (res)
- printf("WARNING: got result of %d when expected 0\n", res);
- _stp_map_print (map, "map[%1s] = %d");
-
- /* create and delete a key */
- _stp_map_set_si (map, "1024", 2048);
- _stp_map_print (map, "map[%1s] = %d");
- _stp_map_set_si (map, "1024", 0);
- _stp_map_print (map, "map[%1s] = %d");
- _stp_map_set_si (map, "1024", 2048);
- _stp_map_print (map, "map[%1s] = %d");
- _stp_map_set_si (map, "1024", 0);
- _stp_map_print (map, "map[%1s] = %d");
-
- /* check that unset values are 0 */
- res = _stp_map_get_si (map, "California");
- if (res)
- printf("ERROR: map[California] = %d (should be 0)\n", res);
-
- /* map[California] = 3 */
- _stp_map_set_si (map, "California", 3);
- _stp_map_print (map, "map[%1s] = %d");
-
- /* test an empty string as key */
- _stp_map_set_si (map, "", 7777);
- _stp_map_print (map, "map[%1s] = %d");
- _stp_map_set_si (map, "", 8888);
- _stp_map_print (map, "map[%1s] = %d");
- _stp_map_set_si (map, "", 0);
- _stp_map_print (map, "map[%1s] = %d");
-
-
- /* add 4 new entries, pushing the others out */
- int i;
- for (i = 6; i < 10; i++)
- {
- char buf[32];
- sprintf (buf, "String %d", i);
- res = _stp_map_set_si (map, buf, 100 + i);
- if (res)
- printf("WARNING: During wrap test, got result of %d when expected 0\n", res);
- }
- _stp_map_print (map, "map[%1s] = %d");
-
- /* turn off wrap and repeat */
- map->wrap = 0;
- for (i = 16; i < 20; i++) {
- char buf[32];
- sprintf (buf, "BAD String %d", i);
- res = _stp_map_set_si (map, buf, 100 + i);
- if (res != -1)
- printf("WARNING: During wrap test, got result of %d when expected -1\n", res);
- }
- _stp_map_print (map, "map[%1s] = %d");
-
- /* test addition */
- for (i = 6; i < 10; i++)
- {
- char buf[32];
- sprintf (buf, "String %d", i);
- res = _stp_map_add_si (map, buf, 1000 * i);
- if (res)
- printf("WARNING: During wrap test, got result of %d when expected 0\n", res);
- }
- _stp_map_print (map, "map[%1s] = %d");
-
- /* reset all */
- for (i = 6; i < 10; i++)
- {
- char buf[32];
- sprintf (buf, "String %d", i);
- res = _stp_map_set_si (map, buf, i);
- if (res)
- printf("WARNING: During wrap test, got result of %d when expected 0\n", res);
- }
- _stp_map_print (map, "map[%1s] = %d");
-
- _stp_map_clear(map);
- _stp_map_print (map, "map[%1s] = %d");
-
- _stp_map_del (map);
- return 0;
-}
diff --git a/runtime/tests/maps/size.c b/runtime/tests/maps/size.c
deleted file mode 100644
index 2fb2575c..00000000
--- a/runtime/tests/maps/size.c
+++ /dev/null
@@ -1,103 +0,0 @@
-#include "runtime.h"
-
-/* test of _stp_map_size() */
-#define VALUE_TYPE INT64
-#define KEY1_TYPE INT64
-#include "map-gen.c"
-
-#include "map.c"
-
-#define check(map,num) \
- { \
- int size = _stp_map_size(map); \
- if (size != num) \
- printf("ERROR at line %d: expected size %d and got %d instead.\n", __LINE__, num, size); \
- }
-
-int main ()
-{
- MAP map = _stp_map_new_ii(4);
- int64_t x;
-
- check (map, 0);
-
- /* map[1] = 2 */
- _stp_map_set_ii(map, 1, 2);
- check (map, 1);
-
- /* map[3] = 4 */
- _stp_map_set_ii(map, 3, 4);
- check (map,2);
-
- /* now try to confuse things */
- /* These won't do anything useful, but shouldn't crash */
- _stp_map_set_ii(0,1,100);
- _stp_map_set_ii(map,0,0);
- _stp_map_set_ii(map,100,0);
- check (map,2);
-
- /* map[5] = 6 */
- _stp_map_set_ii(map, 5, 6);
- check (map,3);
-
- /* set wrap */
- map->wrap = 1;
- /* add 4 new entries, pushing the others out */
- int i, res;
- for (i = 6; i < 10; i++) {
- res = _stp_map_set_ii (map, i, 100 + i);
- if (res)
- printf("WARNING: During wrap test, got result of %d when expected 0\n", res);
- }
- check (map,4);
-
- /* turn off wrap and repeat */
- map->wrap = 0;
- for (i = 16; i < 20; i++) {
- res = _stp_map_set_ii (map, i, 100 + i);
- if (res != -1)
- printf("WARNING: During wrap test, got result of %d when expected -1\n", res);
- }
- check (map,4);
-
- map->wrap = 1;
-
- /* 5, 382, 526, and 903 all hash to the same value (23) */
- /* use them to test the hash chain */
- _stp_map_set_ii (map, 5, 1005);
- _stp_map_set_ii (map, 382, 1382);
- _stp_map_set_ii (map, 526, 1526);
- _stp_map_set_ii (map, 903, 1903);
- check (map,4);
-
- /* now delete all 4 nodes, one by one */
- _stp_map_set_ii (map, 382, 0);
- check (map,3);
-
- _stp_map_set_ii (map, 5, 0);
- check (map,2);
-
- _stp_map_set_ii (map, 903, 0);
- check (map,1);
-
- _stp_map_set_ii (map, 526, 0);
- check (map,0);
-
- /* finally check clearing the map */
- _stp_map_clear(map);
- check (map,0);
-
- map->wrap = 0;
- for (i = 33; i < 99; i+=11)
- _stp_map_set_ii (map, i, 100*i+i);
- check (map,4);
-
- _stp_map_clear(map);
- check (map,0);
-
- _stp_map_set_ii (map, 1970, 1799);
- check (map,1);
-
- _stp_map_del (map);
- return 0;
-}
diff --git a/runtime/tests/maps/sort.c b/runtime/tests/maps/sort.c
deleted file mode 100644
index 7ae22206..00000000
--- a/runtime/tests/maps/sort.c
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "runtime.h"
-
-/* test of map sorting */
-#define VALUE_TYPE STRING
-#define KEY1_TYPE INT64
-#define KEY2_TYPE INT64
-#define KEY3_TYPE STRING
-#include "map-gen.c"
-
-#define VALUE_TYPE INT64
-#define KEY1_TYPE STRING
-#define KEY2_TYPE STRING
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- MAP mapiis = _stp_map_new_iiss(10);
-
- /* try to crash the sorts with sorting an empty list */
- _stp_map_sort (mapiis, 0, -1);
- _stp_map_sort (mapiis, 0, 1);
- _stp_map_sortn (mapiis, 3, 0, -1);
- _stp_map_sortn (mapiis, 0, 0, -1);
-
- /* load some test data */
- _stp_map_add_iiss (mapiis, 3,4,"California","Sacramento" );
- _stp_map_set_iiss (mapiis, 5,6,"Washington","Olympia" );
- _stp_map_set_iiss (mapiis, 7,8,"Oregon","Salem" );
- _stp_map_set_iiss (mapiis, 7,8,"Nevada","Carson City" );
- _stp_map_set_iiss (mapiis, 1, 4,"New Mexico","Santa Fe" );
- _stp_map_set_iiss (mapiis, -1,9,"North Carolina","Raleigh" );
- _stp_map_set_iiss (mapiis, 5,5,"Massachusetts","Boston" );
- _stp_map_set_iiss (mapiis, 2,2,"Vermont","Montpelier" );
- _stp_map_set_iiss (mapiis, 8,8,"Iowa","Des Moines" );
- _stp_map_set_iiss (mapiis, 1,2,"Ohio","Columbus" );
-
- _stp_printf("sorting from A-Z on value\n");
- _stp_map_sort (mapiis, 0, -1);
- _stp_map_print (mapiis, "%s -> %1d %2d %3s");
-
- _stp_printf("\nsorting from Z-A on value\n");
- _stp_map_sort (mapiis, 0, 1);
- _stp_map_print (mapiis, "%s -> %1d %2d %3s");
-
- _stp_printf("\nsorting from low to high on key 1\n");
- _stp_map_sort (mapiis, 1, -1);
- _stp_map_print (mapiis, "%1d %2d %3s -> %s");
-
- _stp_printf("\nsorting from high to low on key 1\n");
- _stp_map_sort (mapiis, 1, 1);
- _stp_map_print (mapiis, "%1d %2d %3s -> %s");
-
- _stp_printf("\nsorting from low to high on key 2\n");
- _stp_map_sort (mapiis, 2, -1);
- _stp_map_print (mapiis, "%1d %2d %3s -> %s");
-
- _stp_printf("\nsorting from high to low on key 2\n");
- _stp_map_sort (mapiis, 2, 1);
- _stp_map_print (mapiis, "%1d %2d %3s -> %s");
-
-
- _stp_printf("\nsorting from low to high on key 3\n");
- _stp_map_sort (mapiis, 3, -1);
- _stp_map_print (mapiis, "%3s\t\t%1d %2d -> %s");
-
- _stp_printf("\nsorting from high to low on key 3\n");
- _stp_map_sort (mapiis, 3, 1);
- _stp_map_print (mapiis, "%3s\t\t%1d %2d -> %s");
-
- _stp_printf("\ntop 3 alphabetical by value\n");
- _stp_map_sortn (mapiis, 3, 0, -1);
- _stp_map_printn (mapiis, 3, "%s -> %1d %2d %3s");
-
- _stp_printf("\nbottom 2 alphabetical by value\n");
- _stp_map_sortn (mapiis, 2, 0, 1);
- _stp_map_printn (mapiis, 2, "%s -> %1d %2d %3s");
-
-
- _stp_printf("\ntop 5 sorted by key 1\n");
- _stp_map_sortn (mapiis, 5, 1, 1);
- _stp_map_printn (mapiis, 5, "%1d %2d %3s -> %s");
- _stp_printf("\nbottom 5 sorted by key 1\n");
- _stp_map_sortn (mapiis, 5, 1, -1);
- _stp_map_printn (mapiis, 5, "%1d %2d %3s -> %s");
-
- MAP mapss = _stp_map_new_ssi(4);
- _stp_map_set_ssi (mapss, "Riga", "Latvia", 135786);
- _stp_map_set_ssi (mapss, "Sofia", "Bulgaria", 138740);
- _stp_map_set_ssi (mapss, "Valletta", "Malta", 1);
- _stp_map_set_ssi (mapss, "Nicosia", "Cyprus", -1);
-
- _stp_printf("sorted by population from low to high\n");
- _stp_map_sort (mapss, 0, -1);
- _stp_map_print (mapss, "%1s is the capitol of %2s and the nerd population is %d");
- _stp_printf("sorted by population from high to low\n");
- _stp_map_sort (mapss, 0, 1);
- _stp_map_print (mapss, "%1s is the capitol of %2s and the nerd population is %d");
-
- _stp_map_del(mapss);
- _stp_map_del(mapiis);
-
- return 0;
-}
diff --git a/runtime/tests/maps/sort2.c b/runtime/tests/maps/sort2.c
deleted file mode 100644
index 0b3bc547..00000000
--- a/runtime/tests/maps/sort2.c
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "runtime.h"
-
-/* test of map sorting. Just like sort.c, except test with an odd number of nodes */
-#define VALUE_TYPE STRING
-#define KEY1_TYPE INT64
-#define KEY2_TYPE INT64
-#define KEY3_TYPE STRING
-#include "map-gen.c"
-
-#define VALUE_TYPE INT64
-#define KEY1_TYPE STRING
-#define KEY2_TYPE STRING
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- MAP mapiis = _stp_map_new_iiss(10);
-
- /* try to crash the sorts with sorting an empty list */
- _stp_map_sort (mapiis, 0, -1);
- _stp_map_sort (mapiis, 0, 1);
- _stp_map_sortn (mapiis, 3, 0, -1);
- _stp_map_sortn (mapiis, 0, 0, -1);
-
- /* load some test data */
- _stp_map_add_iiss (mapiis, 3,4,"California","Sacramento" );
- _stp_map_set_iiss (mapiis, 5,6,"Washington","Olympia" );
- _stp_map_set_iiss (mapiis, 7,8,"Oregon","Salem" );
- _stp_map_set_iiss (mapiis, 7,8,"Nevada","Carson City" );
- _stp_map_set_iiss (mapiis, 1, 4,"New Mexico","Santa Fe" );
- _stp_map_set_iiss (mapiis, -1,9,"North Carolina","Raleigh" );
- _stp_map_set_iiss (mapiis, 5,5,"Massachusetts","Boston" );
- _stp_map_set_iiss (mapiis, 8,8,"Iowa","Des Moines" );
- _stp_map_set_iiss (mapiis, 1,2,"Ohio","Columbus" );
-
- _stp_printf("sorting from A-Z on value\n");
- _stp_map_sort (mapiis, 0, -1);
- _stp_map_print (mapiis, "%s -> %1d %2d %3s");
-
- _stp_printf("\nsorting from Z-A on value\n");
- _stp_map_sort (mapiis, 0, 1);
- _stp_map_print (mapiis, "%s -> %1d %2d %3s");
-
- _stp_printf("\nsorting from low to high on key 1\n");
- _stp_map_sort (mapiis, 1, -1);
- _stp_map_print (mapiis, "%1d %2d %3s -> %s");
-
- _stp_printf("\nsorting from high to low on key 1\n");
- _stp_map_sort (mapiis, 1, 1);
- _stp_map_print (mapiis, "%1d %2d %3s -> %s");
-
- _stp_printf("\nsorting from low to high on key 2\n");
- _stp_map_sort (mapiis, 2, -1);
- _stp_map_print (mapiis, "%1d %2d %3s -> %s");
-
- _stp_printf("\nsorting from high to low on key 2\n");
- _stp_map_sort (mapiis, 2, 1);
- _stp_map_print (mapiis, "%1d %2d %3s -> %s");
-
-
- _stp_printf("\nsorting from low to high on key 3\n");
- _stp_map_sort (mapiis, 3, -1);
- _stp_map_print (mapiis, "%3s\t\t%1d %2d -> %s");
-
- _stp_printf("\nsorting from high to low on key 3\n");
- _stp_map_sort (mapiis, 3, 1);
- _stp_map_print (mapiis, "%3s\t\t%1d %2d -> %s");
-
- _stp_printf("\ntop 3 alphabetical by value\n");
- _stp_map_sortn (mapiis, 3, 0, -1);
- _stp_map_printn (mapiis, 3, "%s -> %1d %2d %3s");
-
- _stp_printf("\nbottom 2 alphabetical by value\n");
- _stp_map_sortn (mapiis, 2, 0, 1);
- _stp_map_printn (mapiis, 2, "%s -> %1d %2d %3s");
-
-
- _stp_printf("\ntop 5 sorted by key 1\n");
- _stp_map_sortn (mapiis, 5, 1, 1);
- _stp_map_printn (mapiis, 5, "%1d %2d %3s -> %s");
- _stp_printf("\nbottom 5 sorted by key 1\n");
- _stp_map_sortn (mapiis, 5, 1, -1);
- _stp_map_printn (mapiis, 5, "%1d %2d %3s -> %s");
-
- MAP mapss = _stp_map_new_ssi(5);
- _stp_map_set_ssi (mapss, "Riga", "Latvia", 135786);
- _stp_map_set_ssi (mapss, "Sofia", "Bulgaria", 138740);
- _stp_map_set_ssi (mapss, "Valletta", "Malta", 1);
- _stp_map_set_ssi (mapss, "Nicosia", "Cyprus", -1);
- _stp_map_set_ssi (mapss, "Chisinau", "Moldova", 1024);
-
- _stp_printf("sorted by population from low to high\n");
- _stp_map_sort (mapss, 0, -1);
- _stp_map_print (mapss, "%1s is the capitol of %2s and the nerd population is %d");
- _stp_printf("sorted by population from high to low\n");
- _stp_map_sort (mapss, 0, 1);
- _stp_map_print (mapss, "%1s is the capitol of %2s and the nerd population is %d");
-
- _stp_map_del(mapss);
- _stp_map_del(mapiis);
-
- return 0;
-}
diff --git a/runtime/tests/maps/sort_stat.c b/runtime/tests/maps/sort_stat.c
deleted file mode 100644
index f3f0435e..00000000
--- a/runtime/tests/maps/sort_stat.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "runtime.h"
-
-/* test of map sorting */
-
-#define VALUE_TYPE STAT
-#define KEY1_TYPE STRING
-#define KEY2_TYPE STRING
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- MAP mapssx = _stp_map_new_ssx (8, HIST_LINEAR, 0, 100, 10 );
- int i,j;
-
- for (i = 0; i < 100; i++)
- for (j = 0; j <= i*10 ; j++ )
- _stp_map_add_ssx (mapssx, "California", "Sacramento", i);
-
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10 ; j++ )
- _stp_map_add_ssx (mapssx, "Washington", "Olympia", j * i );
-
- for (i = 0; i < 100; i += 10)
- for (j = 0; j < i/5 ; j++ )
- _stp_map_add_ssx (mapssx, "Oregon", "Salem", i);
-
- for (i = 0; i < 100; i += 10)
- for (j = 0; j < i/10 ; j++ )
- _stp_map_add_ssx (mapssx, "Nevada", "Carson City", i + j);
-
- for (i = 0; i < 100; i += 10)
- for (j = 0; j < i/20 ; j++ )
- _stp_map_add_ssx (mapssx, "Ohio", "Columbus", 50);
-
- for (i = 0; i < 100; i += 10)
- for (j = 0; j < i/10 ; j++ )
- _stp_map_add_ssx (mapssx, "North Carolina", "Raleigh", 100 - j * i);
-
- for (i = 0; i < 100; i += 10)
- for (j = 0; j < i ; j++ )
- _stp_map_add_ssx (mapssx, "New Mexico", "Santa Fe", 50 - j);
-
-
- _stp_map_print (mapssx, "Bogons per packet for %1s\ncount:%C sum:%S avg:%A min:%m max:%M\n%H");
-
- _stp_printf("SORTED BY COUNT\n");
- _stp_map_sort (mapssx, SORT_COUNT, 1);
- _stp_map_print (mapssx, "%C %1s");
-
- _stp_printf("SORTED BY COUNT (low to high)\n");
- _stp_map_sort (mapssx, SORT_COUNT, -1);
- _stp_map_print (mapssx, "%C %1s");
-
- _stp_printf("SORTED BY SUM\n");
- _stp_map_sort (mapssx, SORT_SUM, 1);
- _stp_map_print (mapssx, "%S %1s");
-
- _stp_printf("SORTED BY SUM (low to high)\n");
- _stp_map_sort (mapssx, SORT_SUM, -1);
- _stp_map_print (mapssx, "%S %1s");
-
- _stp_printf("SORTED BY MIN\n");
- _stp_map_sort (mapssx, SORT_MIN, 1);
- _stp_map_print (mapssx, "%m %1s");
-
- _stp_printf("SORTED BY MIN (low to high)\n");
- _stp_map_sort (mapssx, SORT_MIN, -1);
- _stp_map_print (mapssx, "%m %1s");
-
- _stp_printf("SORTED BY MAX\n");
- _stp_map_sort (mapssx, SORT_MAX, 1);
- _stp_map_print (mapssx, "%M %1s");
-
- _stp_printf("SORTED BY MAX (low to high)\n");
- _stp_map_sort (mapssx, SORT_MAX, -1);
- _stp_map_print (mapssx, "%M %1s");
-
- _stp_printf("SORTED BY AVG\n");
- _stp_map_sort (mapssx, SORT_AVG, 1);
- _stp_map_print (mapssx, "%A %1s");
-
- _stp_printf("SORTED BY AVG (low to high)\n");
- _stp_map_sort (mapssx, SORT_AVG, -1);
- _stp_map_print (mapssx, "%A %1s");
-
- _stp_map_del (mapssx);
- return 0;
-}
diff --git a/runtime/tests/maps/ssssss.c b/runtime/tests/maps/ssssss.c
deleted file mode 100644
index 1cc020b7..00000000
--- a/runtime/tests/maps/ssssss.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "runtime.h"
-
-/* test of maps with keys 5 strings and values of string */
-#define VALUE_TYPE STRING
-#define KEY1_TYPE STRING
-#define KEY2_TYPE STRING
-#define KEY3_TYPE STRING
-#define KEY4_TYPE STRING
-#define KEY5_TYPE STRING
-#include "map-gen.c"
-
-#include "map.c"
-
-int main ()
-{
- struct map_node *ptr;
- MAP map = _stp_map_new_ssssss(4);
-
- _stp_map_set_ssssss (map, "1ABC", "2ABC", "3ABC", "4ABC", "5ABC", "666");
- _stp_map_set_ssssss (map, "1QRS", "2QRS", "3QRS", "4QRS", "5QRS", "777");
- _stp_map_set_ssssss (map, "1abc", "2abc", "3abc", "4abc", "5abc", "888");
- _stp_map_set_ssssss (map, "1XYZ", "2XYZ", "3XYZ", "4XYZ", "5XYZ", "999");
-
- foreach (map, ptr)
- printf ("map[%s, %s, %s, %s, %s] = %s\n",
- _stp_key_get_str(ptr,1),
- _stp_key_get_str(ptr,2),
- _stp_key_get_str(ptr,3),
- _stp_key_get_str(ptr,4),
- _stp_key_get_str(ptr,5),
- _stp_get_str(ptr));
-
-
- _stp_map_print(map,"%1s and %2s and %3s and %4s and %5s ---> %s");
- _stp_map_del (map);
- return 0;
-}