Commit Graph

9 Commits (9afe63b77aba5013dd837b576b1caba302350a92)

Author SHA1 Message Date
Sébastien Helleu 9afe63b77a tests: fix name of tests 2020-04-10 23:43:27 +02:00
Sébastien Helleu 007fd03bc8 tests: add tests on calc functions
Functions tested:

- calc_operator_precedence
- calc_pop_value
- calc_list_free_cb
- calc_operation
- calc_operation_stacks
2020-04-08 21:38:51 +02:00
Sébastien Helleu a693125c81 tests: add missing include of stdio.h (issue #1469) 2020-04-07 22:20:11 +02:00
Sébastien Helleu d78ac827e9 core: fix memory leak in calculation of expression on FreeBSD (closes #1469)
The memory leak was caused by a bug in function setlocale on FreeBSD:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243195

The fix is the following:

* Remove the calls to setlocale when formatting the result.
* The function snprintf is still called, and then is now locale dependent,
  for example in French the decimal separator is a comma instead of a dot.
* A new function calc_sanitize_decimal_number is introduced to "sanitize" a
  decimal number: keep only the decimal separator (replace it by a dot) and
  remove any other separator found.

Unit tests are added on these functions:

* calc_sanitize_decimal_number
* calc_format_result
2020-04-07 21:37:48 +02:00
Sébastien Helleu d91d1ebb8c tests: add other calc tests with multiple operators
The order of operators are different from the initial test, so this increases
the code coverage in wee-calc.c.
2020-01-27 20:54:23 +01:00
Sébastien Helleu feb6258910 core: update copyright dates 2020-01-04 10:41:26 +01:00
Sébastien Helleu 3a356f109f core: add power operator "**" in calc expressions (issue #997) 2019-09-24 21:03:56 +02:00
Sébastien Helleu 7d795c4d53 core: fix wrong results with the unary minus in calc expressions 2019-09-24 20:49:48 +02:00
Sébastien Helleu 997894edc0 core: add calculation of expression in evaluation of expressions with "calc:..." (issue #997) 2019-09-20 21:37:01 +02:00