summaryrefslogtreecommitdiffstats
path: root/generic/tclTestObj.c
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-04-14 03:06:44 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-04-14 03:06:44 (GMT)
commitdcd5ea5b916676bf83a5fd3de9ee1d19e1f45c81 (patch)
tree8038ad324c4b8618e90d3c2f2c5785692a829c12 /generic/tclTestObj.c
parentd8c2bafa2cc1a720d837ffb6a43c2f4d9666ef68 (diff)
downloadtcl-dcd5ea5b916676bf83a5fd3de9ee1d19e1f45c81.zip
tcl-dcd5ea5b916676bf83a5fd3de9ee1d19e1f45c81.tar.gz
tcl-dcd5ea5b916676bf83a5fd3de9ee1d19e1f45c81.tar.bz2
Finish up list tests. Add testbigdata dict command for generating dicts
Diffstat (limited to 'generic/tclTestObj.c')
-rw-r--r--generic/tclTestObj.c20
1 files changed, 15 insertions, 5 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;
}