diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-14 03:06:44 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-14 03:06:44 (GMT) |
commit | dcd5ea5b916676bf83a5fd3de9ee1d19e1f45c81 (patch) | |
tree | 8038ad324c4b8618e90d3c2f2c5785692a829c12 | |
parent | d8c2bafa2cc1a720d837ffb6a43c2f4d9666ef68 (diff) | |
download | tcl-dcd5ea5b916676bf83a5fd3de9ee1d19e1f45c81.zip tcl-dcd5ea5b916676bf83a5fd3de9ee1d19e1f45c81.tar.gz tcl-dcd5ea5b916676bf83a5fd3de9ee1d19e1f45c81.tar.bz2 |
Finish up list tests. Add testbigdata dict command for generating dicts
-rw-r--r-- | generic/tclTestObj.c | 20 | ||||
-rw-r--r-- | tests/bigdata.test | 28 |
2 files changed, 40 insertions, 8 deletions
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 2936345..2e7d70e 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -1528,8 +1528,9 @@ TeststringobjCmd( * TestbigdataCmd -- * * Implements the Tcl command testbigdata - * testbigdata string ?LEN? ?SPLIT? - * testbigdata bytearray ?LEN? ?SPLIT? + * testbigdata string ?LEN? ?SPLIT? - returns 01234567890123... + * testbigdata bytearray ?LEN? ?SPLIT? - returns {0 1 2 3 4 5 6 7 8 9 0 1 ...} + * testbigdata dict ?SIZE? - returns dict mapping integers to themselves * If no arguments given, returns the pattern used to generate strings. * If SPLIT is specified, the character at that position is set to "X". * @@ -1550,10 +1551,10 @@ TestbigdataCmd ( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const subcmds[] = { - "string", "bytearray", "list", NULL + "string", "bytearray", "list", "dict", NULL }; enum options { - BIGDATA_STRING, BIGDATA_BYTEARRAY, BIGDATA_LIST + BIGDATA_STRING, BIGDATA_BYTEARRAY, BIGDATA_LIST, BIGDATA_DICT } idx; char *s; unsigned char *p; @@ -1562,9 +1563,10 @@ TestbigdataCmd ( Tcl_Obj *objPtr; #define PATTERN_LEN 10 Tcl_Obj *patternObjs[PATTERN_LEN]; + Tcl_Obj *keyObjs[PATTERN_LEN]; if (objc < 2 || objc > 4) { - Tcl_WrongNumArgs(interp, 1, objv, "command ?len?"); + Tcl_WrongNumArgs(interp, 1, objv, "command ?len? ?split?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], subcmds, "option", 0, @@ -1647,6 +1649,14 @@ TestbigdataCmd ( } Tcl_SetObjResult(interp, objPtr); break; + case BIGDATA_DICT: + objPtr = Tcl_NewDictObj(); + for (i = 0; i < len; ++i) { + Tcl_Obj *objPtr2 = Tcl_NewWideIntObj(i); + Tcl_DictObjPut(interp, objPtr, objPtr2, objPtr2); + } + Tcl_SetObjResult(interp, objPtr); + break; } return TCL_OK; } diff --git a/tests/bigdata.test b/tests/bigdata.test index 1c107d7..d046df2 100644 --- a/tests/bigdata.test +++ b/tests/bigdata.test @@ -948,6 +948,23 @@ bigtestRO lsearch-bigdata-1 "lsearch" {4294967300 4294967310 -1} -body { } -constraints bug-a4617c8e90 # +# lseq +bigtest lseq-bigdata-1 "lseq" {4294967297 4294967296} -body { + list [llength $l] [lindex $l 0x100000000] +} -setup { + set l [lseq 0x100000001] +} -cleanup { + bigClean +} +bigtest lseq-bigdata-2 "lseq" {9223372036854775807 9223372036854775799} -body { + list [llength $l] [lindex $l 9223372036854775800] +} -setup { + set l [lseq 0x7fffffffffffffff]; llength $l +} -cleanup { + bigClean +} -constraints bug-fa00fbbbab + +# # lset bigtest lset-bigdata-1 "lset" {4294967297 4294967297 {1 2 3 4 5 X}} -body { list [llength [lset l 0x100000000 X]] [llength $l] [lrange $l end-5 end] @@ -992,13 +1009,18 @@ bigtest split-bigdata-1 "split" {4294967296 {0 1 2 3 4} {1 2 3 4 5}} -body { bigClean } -constraints bug-takesTooLong +bigtestRO concat-bigdata-1 "concat" {4294967296 {0 1 2 3 4} {6 7 0 1 2} {3 4 5 6 7}} -body { + unset -nocomplain l2 + set l2 [concat $l $l] + list [llength $l2] [lrange $l2 0 4] [lrange $l2 0x80000000-2 0x80000000+2] [lrange $l2 end-4 end] +} -setup { + set l [bigList 0x80000000] +} + # # TODO -# concat # encoding convertfrom # encoding convertto -# lseq -# split # dict * |