diff options
author | antirez <antirez> | 2005-03-21 12:39:36 +0000 |
---|---|---|
committer | antirez <antirez> | 2005-03-21 12:39:36 +0000 |
commit | 28c3361d618f6ad15528fffdbfe3bee0fec8f790 (patch) | |
tree | 37041c96caba80c329b474436339a6d984217448 | |
parent | d9ffadaa5411d62ff47c46532305dcac85c4e0bb (diff) | |
download | jimtcl-28c3361d618f6ad15528fffdbfe3bee0fec8f790.zip jimtcl-28c3361d618f6ad15528fffdbfe3bee0fec8f790.tar.gz jimtcl-28c3361d618f6ad15528fffdbfe3bee0fec8f790.tar.bz2 |
Modified test.tcl to report the list of failed tests at the end.
-rw-r--r-- | ChangeLog | 37 | ||||
-rw-r--r-- | jim.c | 97 | ||||
-rw-r--r-- | test.tcl | 9 |
3 files changed, 92 insertions, 51 deletions
@@ -1,3 +1,40 @@ +2005-03-21 12:59 chi + + * jim.c, jim.h, test.tcl: Add the [scan] command and the + Jim_ScanString function + tests. + + The scanformat specification will be converted to a new Jim_Obj + of type + scanFormatStringObjType, that will contain the parsed + representation within its internal object representation. This + speed up multiple scanning within e.g. a loop, of objects were + cached. + + For internal scanning we use sscanf currently (I am lazy right + now). That + means also, we will inherit its incapability to handle string + with embedded ZERO. It would be not too difficult to implement + another scanner just for the string and charset conversion type + that could be able to handle those embedded ZEROs, however. + + Furthermore two small details were fixed: + + 1. Jim_DoubleToString should also recognize a number if a leading + '+' or '-' occured. By recognizing I mean, add a ".0" to such + a number. + + 2. Jim_StrDupLen should also properly handle duplication of + substrings. So now it should be possible to do this: + + const char *str1 = "This is a long string"; + char *substr1 = Jim_StrDupLen(str1, 4); + + Now substr1 should contain a properly ZERO ended "This". + +2005-03-19 22:39 antirez + + * ChangeLog, jim.c, test.tcl: Jim_GetIndex() bug fixed (SS) + 2005-03-19 20:12 antirez * ChangeLog, Makefile, TODO, jim.c, jim.h: [finalize] command and @@ -1,7 +1,7 @@ /* Jim - A small embeddable Tcl interpreter * Copyright 2005 Salvatore Sanfilippo <antirez@invece.org> * - * $Id: jim.c,v 1.123 2005/03/21 11:59:44 chi Exp $ + * $Id: jim.c,v 1.124 2005/03/21 12:39:36 antirez Exp $ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -5649,42 +5649,41 @@ typedef struct Jim_ExprOperator { /* Exrp's Stack machine operators opcodes. */ -/* Operators */ -#define JIM_EXPROP_NOT 0 -#define JIM_EXPROP_BITNOT 1 -#define JIM_EXPROP_UNARYMINUS 2 -#define JIM_EXPROP_UNARYPLUS 3 - -#define JIM_EXPROP_MUL 4 -#define JIM_EXPROP_DIV 5 -#define JIM_EXPROP_MOD 6 - -#define JIM_EXPROP_SUB 7 -#define JIM_EXPROP_ADD 8 - -#define JIM_EXPROP_LSHIFT 9 -#define JIM_EXPROP_RSHIFT 10 -#define JIM_EXPROP_ROTL 11 -#define JIM_EXPROP_ROTR 12 - -#define JIM_EXPROP_LT 13 -#define JIM_EXPROP_GT 14 -#define JIM_EXPROP_LTE 15 -#define JIM_EXPROP_GTE 16 - -#define JIM_EXPROP_NUMEQ 17 -#define JIM_EXPROP_NUMNE 18 - -#define JIM_EXPROP_STREQ 19 -#define JIM_EXPROP_STRNE 20 - -#define JIM_EXPROP_BITAND 21 -#define JIM_EXPROP_BITXOR 22 -#define JIM_EXPROP_BITOR 23 - -#define JIM_EXPROP_LOGICAND 24 -#define JIM_EXPROP_LOGICOR 25 - +/* Binary operators (numbers) */ +#define JIM_EXPROP_BINARY_NUM_FIRST 0 /* first */ +#define JIM_EXPROP_MUL 0 +#define JIM_EXPROP_DIV 1 +#define JIM_EXPROP_MOD 2 +#define JIM_EXPROP_SUB 3 +#define JIM_EXPROP_ADD 4 +#define JIM_EXPROP_LSHIFT 5 +#define JIM_EXPROP_RSHIFT 6 +#define JIM_EXPROP_ROTL 7 +#define JIM_EXPROP_ROTR 8 +#define JIM_EXPROP_LT 9 +#define JIM_EXPROP_GT 10 +#define JIM_EXPROP_LTE 11 +#define JIM_EXPROP_GTE 12 +#define JIM_EXPROP_NUMEQ 13 +#define JIM_EXPROP_NUMNE 14 +#define JIM_EXPROP_BITAND 15 +#define JIM_EXPROP_BITXOR 16 +#define JIM_EXPROP_BITOR 17 +#define JIM_EXPROP_LOGICAND 18 +#define JIM_EXPROP_LOGICOR 19 +#define JIM_EXPROP_BINARY_NUM_LAST 19 /* last */ + +/* Binary operators (strings) */ +#define JIM_EXPROP_STREQ 20 +#define JIM_EXPROP_STRNE 21 + +/* Unary operators (numbers) */ +#define JIM_EXPROP_NOT 22 +#define JIM_EXPROP_BITNOT 23 +#define JIM_EXPROP_UNARYMINUS 24 +#define JIM_EXPROP_UNARYPLUS 25 + +/* Ternary operators */ #define JIM_EXPROP_TERNARY 26 /* Operands */ @@ -6236,17 +6235,6 @@ int Jim_EvalExpression(Jim_Interp *interp, Jim_Obj *exprObjPtr, int Alen, Blen, retcode; switch(expr->opcode[i]) { - case JIM_EXPROP_SUBST: - if ((retcode = Jim_SubstObj(interp, expr->obj[i], - &objPtr, JIM_NONE)) != JIM_OK) - { - error = 1; - errRetCode = retcode; - goto err; - } - stack[stacklen++] = objPtr; - Jim_IncrRefCount(objPtr); - break; case JIM_EXPROP_NUMBER: case JIM_EXPROP_STRING: stack[stacklen++] = expr->obj[i]; @@ -6261,6 +6249,17 @@ int Jim_EvalExpression(Jim_Interp *interp, Jim_Obj *exprObjPtr, stack[stacklen++] = objPtr; Jim_IncrRefCount(objPtr); break; + case JIM_EXPROP_SUBST: + if ((retcode = Jim_SubstObj(interp, expr->obj[i], + &objPtr, JIM_NONE)) != JIM_OK) + { + error = 1; + errRetCode = retcode; + goto err; + } + stack[stacklen++] = objPtr; + Jim_IncrRefCount(objPtr); + break; case JIM_EXPROP_DICTSUGAR: objPtr = Jim_ExpandDictSugar(interp, expr->obj[i]); if (objPtr == NULL) { @@ -10710,7 +10709,7 @@ int Jim_InteractivePrompt(Jim_Interp *interp) printf("Welcome to Jim version %d.%d, " "Copyright (c) 2005 Salvatore Sanfilippo\n", JIM_VERSION / 100, JIM_VERSION % 100); - printf("CVS ID: $Id: jim.c,v 1.123 2005/03/21 11:59:44 chi Exp $\n"); + printf("CVS ID: $Id: jim.c,v 1.124 2005/03/21 12:39:36 antirez Exp $\n"); Jim_SetVariableStrWithStr(interp, "jim_interactive", "1"); while (1) { char buf[1024]; @@ -1,4 +1,4 @@ -# $Id: test.tcl,v 1.24 2005/03/21 11:59:44 chi Exp $ +# $Id: test.tcl,v 1.25 2005/03/21 12:39:36 antirez Exp $ # # This are Tcl tests imported into Jim. Tests that will probably not be passed # in the long term are usually removed (for example all the tests about @@ -8,10 +8,11 @@ # Sometimes tests are modified to reflect different error messages. set failedTests 0 +set failedList {} set passedTests 0 proc test {id descr script expectedResult} { - global failedTests passedTests + global failedTests failedList passedTests puts -nonewline "$id $descr: " set result [uplevel 1 $script] @@ -23,6 +24,7 @@ proc test {id descr script expectedResult} { puts "Expected: '$expectedResult'" puts "Got : '$result'" incr failedTests + lappend failedList $id } } @@ -4069,5 +4071,8 @@ test regression-1.1 {lrange bug with negative indexes of type int} { puts "----------------------------------------------------------------------" puts "FAILED: $failedTests" +foreach testId $failedList { + puts "\t$testId" +} puts "PASSED: $passedTests" puts "----------------------------------------------------------------------\n" |