aboutsummaryrefslogtreecommitdiff
path: root/tests/expr-old.test
AgeCommit message (Collapse)AuthorFilesLines
2023-07-04tcltest: rework constraint systemSteve Bennett1-7/+3
Now 'constraint cmd|package' is like 'needs' but sets a constraint The command to 'needs cmd' and 'constraint cmd' can now take a subcommand to check. Add 'constraint|needs eval|expr' to make some constraint checks simpler. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-03-09expr: TIP 526, only support a single argSteve Bennett1-12/+12
Avoid unexpected issues by concatenating multiple arguments. This does create an incompatibility with early versions, but it is generally trivial to convert existing code to one of two forms: 1. expr {$a + $b} -- usually correct 2. expr "$a + $b" -- usually incorrect Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-11-16expr: TIP 582 - comments in expressionsSteve Bennett1-3/+5
Add support for comments in expressions Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-08-17expr: fix adjacent terms in function callsSteve Bennett1-1/+1
Previously two adjacent terms were incorrectly accepted, such as in pow(2 3) Correctly generate an error in this case and improve the error message when an expression fails to parse correctly. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-08-17expr: Improve mathfunc handlingSteve Bennett1-59/+63
Previously math functions with multiple arguments were handling poorly. For example: pow(1.0 + 3.0 - 2, .8 * 5) was evaluated as: pow(1.0 + 3.0, 2 - .8 * 5) Now commas correctly separate function parameters. Also, the error messages are more consistent and informative in the case of an invalid expression. Update and re-enable tests in tests/expr-old.test accordingly Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-08-17expr: add support for atan2, hypot and fmodSteve Bennett1-26/+33
And enable some more math tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2012-08-07Remove octal literals with a leading 0 (TIP #114)Steve Bennett1-1/+1
Now an octal literal needs to be explicitly indicated with a leading 0o or 0O, otherwise the number is treated as decimal. This patch also adds support for binary literals. e.g. 0b101 0B1101 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-15Fix for right-to-left associativity of ternary operatorSteve Bennett1-3/+3
Signed-off-by: Patrick WEBER <patrick.weber@live.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-22Overhaul unit test frameworkSteve Bennett1-2/+2
Much closer to tcltest now, including constraints. Try to get all appropriate tests running under both Jim and Tcl. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up the indentation messSteve Bennett1-14/+2
Use 'indent'. Not perfect, but at least consistent. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15More expr tests and fixesSteve Bennett1-7/+8
*: Add tests/expr-new.test from Tcl *: Directly convert from int to double if possible *: Always treat '-' in front of a number as unary minus so that '-0x1234' works. *: Fix expr when the variable does not exist *: Add optional support for math functions *: Also double/0 == Inf or -Inf
2010-10-15Fix many problem with expr evaluationSteve Bennett1-0/+849
*: Import Tcl expr tests (expr-old.test) and fix things: *: !double should be boolean (int) *: double&&double and double||double should be boolean (int) *: 2.34e+1 and 2.0e2 are an acceptable double values *: precedence of && and || is not equal *: precedence of ? and : is not equal *: expression "2:3" is invalid *: lazy evaluation involving multiple && and || was quite wrong *: Fix unary minus wrt subexpressions. e.g. -(-1.5) *: Also add support for functions: int, double, abs, round *: Fix lazy evaluation of ternary operator *: Error on missing ?, missing : *: Fix double unary minus *: Add unary plus *: Fix parsing of double with no '.' before 'e'. Also support 'E'. *: Right-to-left associativity of ternary operator is *almost* correct *: Import div/mod of -ve integers from Tcl *: Rotate (<<< and >>>) failed because of wrong arity *: Don't use auto-converted double values *: When an expression fails, show the expression *: Bump version to 0.62