diff options
Diffstat (limited to 'runtime/tests/maps/map.test')
-rw-r--r-- | runtime/tests/maps/map.test | 463 |
1 files changed, 8 insertions, 455 deletions
diff --git a/runtime/tests/maps/map.test b/runtime/tests/maps/map.test index 61b81855..f3a385dd 100644 --- a/runtime/tests/maps/map.test +++ b/runtime/tests/maps/map.test @@ -8,164 +8,6 @@ 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 ii {Test of int64 keys and int64 values} -setup { - puts "gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ii.c" - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ii.c -} -body { - exec ./test -} -result {map[1]=2 -map[1] = 2 - -map[1] = 2 -map[3] = 4 - -map[1] = 2 -map[3] = 4 - -map[1] = 2 -map[3] = 4 - -map[1] = 2 -map[3] = 4 - -map[0]=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[0]=0 -map[1] = one -map[3] = three -map[5] = five - -map[1] = one -map[3] = three -map[5] = - -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 - -} - -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[Ohio] = 1 -map[Washington] = 2 - -map[0]=0 -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[String 6] = 106 -map[String 7] = 107 -map[String 8] = 108 -map[String 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 - -} - test isx {Test of int64 keys and stat values} -setup { exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test isx.c } -body { @@ -239,186 +81,7 @@ value |-------------------------------------------------- count 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 524288 } -test isx2 {Test of int64 keys and stat values} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test isx2.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 - 512 | 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 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] = 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 -map[0, 0, ] = XX -} - -test test_list_int64 {Test of lists of int64s} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test test_list_int64.c -} -body { - exec ./test -} -result {list[0] = 0 -list[1] = 1 -list[2] = 2 -list[3] = 3 -list[4] = 4 -list[5] = 5 -list[6] = 6 -list[7] = 7 -list[8] = 8 -list[9] = 9 - -size is 10 - -list[0] = 0 -list[1] = 1 -list[2] = 2 -list[3] = 3 -list[4] = 4 -list[5] = 5 -list[6] = 6 -list[7] = 7 -list[8] = 8 -list[9] = 9 - - -newlist[0] = 50 -newlist[1] = 51 -newlist[2] = 52 -newlist[3] = 53 -newlist[4] = 54 -} - - -test test_list_string {Test of lists of strings} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test test_list_string.c -} -body { - exec ./test -} -result {list[0] = Item0 -list[1] = Item1 -list[2] = Item2 -list[3] = Item3 -list[4] = Item4 -list[5] = Item5 -list[6] = Item6 -list[7] = Item7 -list[8] = Item8 -list[9] = Item9 - -size is 10 - -list[0] = Item0 -list[1] = Item1 -list[2] = Item2 -list[3] = Item3 -list[4] = Item4 -list[5] = Item5 -list[6] = Item6 -list[7] = Item7 -list[8] = Item8 -list[9] = Item9 - - -newlist[0] = Item50 -newlist[1] = Item51 -newlist[2] = Item52 -newlist[3] = Item53 -newlist[4] = Item54 -} test map_format {Torture test of map formatting} -setup { exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test map_format.c @@ -505,92 +168,6 @@ mapsst[ Riga, Latvia] = 322D82 mapsst[ Sofia, Bulgaria] = 7E9 mapsst[ Valletta, Malta] = B22} -test map_format2 {Torture test of map formatting} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test map_format2.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 { @@ -603,18 +180,6 @@ 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 { @@ -762,8 +327,8 @@ 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 ii2 {Test of int64 keys and int64 values} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ii2.c +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 @@ -807,8 +372,8 @@ map[66] = 6666 map[1970] = 1799 } -test is2 {Test of int64 keys and string values} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test is2.c +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 @@ -863,8 +428,8 @@ map[8] = new value of 8 map[9] = new value of 9 } -test si2 {Test of string keys and int64 values} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test si2.c +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 @@ -930,8 +495,8 @@ map[String 9] = 9 } -test iiss2 {Test of int64,int64,string keys and string values} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test iiss2.c +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 @@ -1094,18 +659,6 @@ map[1XYZ, 2XYZ, 3XYZ, 4XYZ, 5XYZ] = 999 1XYZ and 2XYZ and 3XYZ and 4XYZ and 5XYZ ---> 999 } -test keys {Test reading keys} -setup { - exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test keys.c -} -body { - exec ./test -} -result {map[0, Boston, MA, 1970] = 5224303 -map[1, Chicago, IL, 2000] = 8272768 -map[-1, unknown, , 2010] = 1000000000 -map[bad type, 0, 0, bad type] = bad type -map[bad type, 0, 0, bad type] = bad type -map[bad type, 0, 0, bad type] = bad type} - - catch {exec rm test} cleanupTests |