package require tcltest namespace import -force tcltest::* set CFLAGS {-O3} test long_int64_1 {Test of long keys and int64 values} -setup { exec gcc $CFLAGS -o test testl64.c } -body { exec ./test } -result {mymap[1]=2 mymap[101]=202 mymap[1]=2 mymap[42]=83 mymap[42]=84 mymap[1024]=2048 mymap[1024]=0 mymap[10]=0 mymap[1] = 2 mymap[42] = 84 mymap[101] = 202 mymap[42] = 84 mymap[101] = 202 mymap[101] = 202 mymap[10]=20 mymap[0] = 100 mymap[1] = 102 mymap[2] = 104 mymap[3] = 106 mymap[5] = 1005 mymap[382] = 1382 mymap[526] = 1526 mymap[903] = 1903 mymap[5] = 1005 mymap[526] = 1526 mymap[903] = 1903 mymap[526] = 1526 mymap[903] = 1903 mymap[526] = 1526 } test long_int64_2 {Range test of long keys and int64 values} -setup { exec gcc $CFLAGS -o test testl64R.c } -body { exec ./test } -result {mymap[1] = -9223372036854775808 mymap[2] = 9223372036854775807 mymap[4] = -1 mymap[5] = 5 mymap[999996] = 1999992 mymap[999997] = 1999994 mymap[999998] = 1999996 mymap[999999] = 1999998} # same test as long_int64_1, except dynamic alloc test long_int64_3 {Test of long keys and int64 values, dynamic allocation} -setup { exec gcc $CFLAGS -o test testl64_alloc.c } -body { exec ./test } -result {mymap[1]=2 mymap[101]=202 mymap[1]=2 mymap[42]=83 mymap[42]=84 mymap[1024]=2048 mymap[1024]=0 mymap[10]=0 mymap[1] = 2 mymap[42] = 84 mymap[101] = 202 mymap[42] = 84 mymap[101] = 202 mymap[101] = 202 mymap[10]=20 mymap[10] = 20 mymap[0] = 100 mymap[1] = 102 mymap[2] = 104 mymap[3] = 106 mymap[5] = 1005 mymap[382] = 1382 mymap[526] = 1526 mymap[903] = 1903 mymap[5] = 1005 mymap[526] = 1526 mymap[903] = 1903 mymap[526] = 1526 mymap[903] = 1903 mymap[526] = 1526 } test long_long_int64_1 {Test of long,long keys and int64 values} -setup { exec gcc $CFLAGS -o test testll64.c } -body { exec ./test } -result {mymap[1,1]=1 mymap[1,2]=2 mymap[2,1]=3 mymap[1,1] = 1 mymap[1,2] = 2 mymap[2,1] = 3} test str_int64_4 {Test of string keys and int64 values} -setup { exec gcc $CFLAGS -o test teststr.c } -body { exec ./test } -result {mymap[two]=2 mymap[two-oh-two]=202 mymap[two]=2 mymap[eighty-four]=83 mymap[eighty-four]=84 mymap[two] = 2 mymap[eighty-four] = 84 mymap[two-oh-two] = 202 mymap[0123456789] = 1000000 mymap[2048]=2048 mymap[2048]=0 mymap[10]=0 mymap[eighty-four] = 84 mymap[two-oh-two] = 202 mymap[0123456789] = 1000000 mymap[eighty-four] = 84 mymap[0123456789] = 1000000 mymap[0123456789] = 1000000 mymap[Ohio]=10123456 mymap[Ohio] = 10123456 mymap[test_number_0] = 1000 mymap[test_number_1] = 1001 mymap[test_number_2] = 1002 mymap[test_number_3] = 1003} test str_str_int64_1 {Test of string,string keys and int64 values} -setup { exec gcc $CFLAGS -o test teststrstr.c } -body { exec ./test } -result {mymap[two,three]=6 mymap[two-oh-two,four]=808 mymap[two,three]=6 mymap[eighty-four,two]=167 mymap[eighty-four,two]=168 mymap[two,three] = 6 mymap[eighty-four,two] = 168 mymap[two-oh-two,four] = 808 mymap[0123456789,foo] = 1000000 mymap[2048,2]=4096 mymap[2048,2]=0 mymap[10,six]=0 mymap[eighty-four,two] = 168 mymap[two-oh-two,four] = 808 mymap[0123456789,foo] = 1000000 mymap[eighty-four,two] = 168 mymap[0123456789,foo] = 1000000 mymap[eighty-four,two] = 168 mymap[0123456789,foo] = 1000000 mymap[Ohio,1801] = 10123456 mymap[test_number_2,**test number 4**] = 8 mymap[test_number_3,**test number 9**] = 27 mymap[test_number_4,**test number 16**] = 64 mymap[test_number_5,**test number 25**] = 125} test str_long_int64_1 {Test of string,long keys and int64 values} -setup { exec gcc $CFLAGS -o test teststrlong.c } -body { exec ./test } -result {map[two,3]=6 map[two-oh-two,4]=808 map[two,3]=6 map[eighty-four,2]=167 map[eighty-four,2]=168 map[two,3] = 6 map[eighty-four,2] = 168 map[two-oh-two,4] = 808 map[0123456789,4444] = 1000000 map[2048,2]=4096 mymap[2048,2]=0 mymap[six,10]=0 map[eighty-four,2] = 168 map[two-oh-two,4] = 808 map[0123456789,4444] = 1000000 map[eighty-four,2] = 168 map[0123456789,4444] = 1000000 map[eighty-four,2] = 168 map[0123456789,4444] = 1000000 map[Ohio,1801] = 10123456 map[test_number_2,2] = 8 map[test_number_3,3] = 27 map[test_number_4,4] = 64 map[test_number_5,5] = 125 Should be empty: } test long_str_int64_1 {Test of long,string keys and int64 values} -setup { exec gcc $CFLAGS -o test testlongstr.c } -body { exec ./test } -result {map[3,two]=6 map[4,two-oh-two]=808 map[3,two]=6 map[2,eighty-four]=167 map[2,eighty-four]=168 map[3,two] = 6 map[2,eighty-four] = 168 map[4,two-oh-two] = 808 map[4444,0123456789] = 1000000 map[2048,2]=4096 mymap[2048,2]=0 mymap[10,six]=0 map[2,eighty-four] = 168 map[4,two-oh-two] = 808 map[4444,0123456789] = 1000000 map[2,eighty-four] = 168 map[4444,0123456789] = 1000000 map[2,eighty-four] = 168 map[1801,Ohio] = 10123456 map[2,test_number_2] = 8 map[3,test_number_3] = 27 map[4,test_number_4] = 64 map[5,test_number_5] = 125 Should be empty: } test str_str_str_1 {Test of string,string keys and string values} -setup { exec gcc $CFLAGS -o test teststrstrstr.c } -body { exec ./test } -result {map[two,2]=four map[two-two-one-B,Baker Street]=7% solution map[two,2]=four map[eighty-four,nineteen hundred]=nineteen hundred and eighty-three map[eighty-four,nineteen hundred]=nineteen hundred and eighty-four map[two,2] = four map[eighty-four,nineteen hundred] = nineteen hundred and eighty-four map[two-two-one-B,Baker Street] = 7% solution map[0123456789,4444] = 1000000 map[2048,2]=4096 mymap[2048,2]=(null) mymap[six,10]=(null) map[eighty-four,nineteen hundred] = nineteen hundred and eighty-four map[two-two-one-B,Baker Street] = 7% solution map[0123456789,4444] = 1000000 map[eighty-four,nineteen hundred] = nineteen hundred and eighty-four map[0123456789,4444] = 1000000 map[eighty-four,nineteen hundred] = nineteen hundred and eighty-four map[0123456789,4444] = 1000000 map[abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ,(null)] = TESTING 1,2,3 map[abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZhiasdhgfiudsgfiusdgfisdugfisdugfsdiufgsdfiugsdifugsdiufgsdiufgisdugfisdugfigsdfiusdgfiugsdifu sdfigsdifugsdifugsdiufgsdiufgisdugfiudsgfisudgfiusdgfiusdgfisdugfisdufgiusdfgsdiufgdsiufgsdiufgsdiufgsdiufgwiugfw89e4rf98yf897ywef98wyef98wyf98wyf89ys9d8yfsd sdfysd98fy9s8fyds98fy98dsfy89sdfy,yw98fty98sfts98d7fts89d7f9sdfoooooooooooooooooooooooooooooooooooooooooooof8eo7stfew87fwet8tw87rf7fpowft7ewfptpwefpwetfpwepwfwetfp8we] = TESTING 1,2,3 ***************************************************************************************************************************************************************************************************************************************************************************** 4,5,6 map[test_number_2,TEST_NUMBER_4] = TEST_NUMBER_8 map[test_number_3,TEST_NUMBER_9] = TEST_NUMBER_27 map[test_number_4,TEST_NUMBER_16] = TEST_NUMBER_64 map[test_number_5,TEST_NUMBER_25] = TEST_NUMBER_125 Should be empty: } test stat_1 {Test of string,long keys and stat values} -setup { exec gcc $CFLAGS -o test teststat.c } -body { exec ./test } -result {map[created with set,2001] = [c=5 s=125 minmax =2,42] map[created with set,2001] = [c=6 s=142 minmax =2,42] map[created with add,2020] = [c=1 s=1700 minmax =1700,1700] map[created with add,2020] = [c=2 s=1702 minmax =2,1700] map[created with add,2020] = [c=3 s=4047 minmax =2,2345] map[created with set,2001] = [c=6 s=142 minmax =2,42] map[created with add,2020] = [c=3 s=4047 minmax =2,2345] map[created with add,2020] = [c=3 s=4047 minmax =2,2345] map[created with add,2020] = [c=5 s=123456 minmax =2,42] map[created with add,1234] = [c=2 s=100 minmax =42,58] map[created with add,1234] = [c=2 s=100 minmax =42,58] } test list_1 {Test of List of string values} -setup { exec gcc $CFLAGS -o test testlist.c } -body { exec ./test } -result {map[0] = Item0 map[1] = Item1 map[2] = Item2 map[3] = Item3 map[4] = Item4 map[5] = Item5 map[6] = Item6 map[7] = Item7 map[8] = Item8 map[9] = Item9 size is 10 map[0] = Item0 map[1] = Item1 map[2] = Item2 map[3] = Item3 map[4] = Item4 map[5] = Item5 map[6] = Item6 map[7] = Item7 map[8] = Item8 map[9] = Item9 map[0] = Item0 map[1] = Item1 map[2] = Item2 map[3] = Item3 map[4] = Item4 map[5] = Item5 map[6] = Item6 map[7] = Item7 map[8] = Item8 map[9] = Item9 map[0] = Item50 map[1] = Item51 map[2] = Item52 map[3] = Item53 map[4] = Item54 } exec rm test cleanupTests