Commit Graph

90 Commits

Author SHA1 Message Date
ISibboI
e63a99af80
Merge branch 'main' into main 2023-05-27 10:42:40 +03:00
Sebastian Schmidt
c01a23bcf8 Return Ok when disabling builtin functions in EmptyContext and enabling builtin functions in EmptyContextWithBuiltinFunctions.
These are noops anyways.
2023-05-21 10:30:53 +03:00
Sebastian Schmidt
5a4dcf9516 Fix docs and error types. 2023-05-21 10:30:53 +03:00
Codex Yore
24c1749143 Resolving issues for PR #129 2023-05-21 10:30:53 +03:00
Codex Yore
50532c5db5 feature_method_to_disable_builtin_function 2023-05-21 10:30:53 +03:00
LinuxHeki
d9698df268 math::abs of int returns int 2023-05-21 09:12:12 +02:00
LinuxHeki
9bbb152b4a add tests for math::abs 2023-05-20 15:36:45 +02:00
Nick
8b8af31eb8 contains + contains_any builtins 2023-05-10 12:31:33 -05:00
Sebastian Schmidt
4fd86751dc Fix unary operator precedence.
Before, unary operators that appeared after an operator with higher precedence would be executed after that operator.

However, in evalexpr, the two unary operators are prefix operators negation and not, and prefix operators always happen before operators directly left of them.
2023-04-13 14:42:39 +03:00
Sebastian Schmidt
9d0a776346 Add test for powers of negative numbers. 2023-04-13 14:21:44 +03:00
Sebastian Schmidt
94b9f1c9be Fix lints. 2023-04-13 14:05:02 +03:00
natan
ebd08caa91 Formats code. 2022-11-21 19:50:22 +02:00
Natan Freeman
927e0e4075 Replaces f64 and i64 with FloatType and IntType. 2022-09-14 21:36:36 +03:00
Sebastian Schmidt
70a749194f Add tests for iterating only variable names in a context.
Relates to #108
2022-07-22 12:18:56 +03:00
Tobias Schmitt
532e2ed770 adds iter_(read/write)_variable_identifiers
seperate iterator returns for read and write variable identifiers.
this is useful in our project and i suspect it might be of use for
others too.
2022-07-21 21:12:26 +02:00
Sebastian Schmidt
a4f49de71a Add tests for context variable iteration.
Relates to #108
2022-07-15 13:50:14 +03:00
Sebastian Schmidt
e70e9d366a Use explicit operator type for reading and writing variables.
Before, variables written to were represented with the same operator as constants in the AST. This was hacky and confusing to some users.

Closes #106
2022-07-04 17:10:28 +03:00
Sebastian Schmidt
65fadfd164 Add tests for left-hand side of assignment being an identifier.
Relates to #106
2022-07-04 16:50:50 +03:00
Sebastian Schmidt
d9c5d5dbbb Test new TryFrom<Value> impls.
Closes #105
2022-07-04 14:39:27 +03:00
Ophir LOJKINE
9d5ef651ae cargo fmt 2022-03-23 18:09:23 +01:00
Ophir LOJKINE
8eedf720e7 Implement changes requested in PR
https://github.com/ISibboI/evalexpr/pull/101#issuecomment-1076466426
2022-03-23 16:33:53 +01:00
Ophir LOJKINE
678c881377 fix test 2022-03-23 13:56:22 +01:00
Ophir LOJKINE
3c4a429e8d Remove is_sumbnormal 2022-03-23 13:11:41 +01:00
Ophir LOJKINE
ea42cf6355 Add support for is_nan, is_finite, and other floating-point testing functions 2022-03-23 13:04:09 +01:00
Ophir LOJKINE
004c2c9f03 more tests 2022-03-14 15:30:52 +01:00
Ophir LOJKINE
9eedc8e93b cargo fmt 2022-03-14 15:07:38 +01:00
Ophir LOJKINE
a219f0b66f Add an "if" function
If the first argument is true, returns the second argument, otherwise, return the third
2022-03-14 14:59:48 +01:00
Diane Sparks
284ddfd567
Add comment separator for bitwise tests 2022-03-06 10:20:40 -08:00
Diane Sparks
d6fafc171d
Add bitwise shift functions 2022-03-06 10:17:37 -08:00
Sebastian Schmidt
79cb25bc9d Increase test coverage. 2022-01-13 15:18:06 +02:00
Sebastian Schmidt
4e5e218d3e Fix #94.
Introduce a new error type for illegal parenthese expressions such as `4(5)`.
2022-01-13 14:50:38 +02:00
Sebastian Schmidt
2ffc88a22e Add failing examples from issue.
Relates to #94
2022-01-13 13:52:51 +02:00
Sebastian Schmidt
b3be7f600c Implement bitwise operators as builtin functions.
Relates to #88
2021-10-12 14:59:10 +03:00
Sebastian Schmidt
e0d4ef24e5 Increase test coverage. 2021-08-16 14:23:02 +03:00
Sebastian Schmidt
efd7ef5dcf Format code. 2021-08-16 13:33:56 +03:00
Jakub Dąbek
6be3b7d80e Make Function able to hold capturing closures.
This commit "reverts" a change introduced in bee98999,
by making `Function` be simultaneously `Fn` and `Clone`.
2021-08-15 20:11:00 +02:00
Sebastian Schmidt
fc2f5ac50d Add test case for potential error.
Relates to #89.
2021-08-01 15:13:58 +03:00
Dennis Marttinen
fbbecc766f
Add support for scientific notation of the form <coefficient>e{+,-,}<exponent> 2021-07-20 20:34:51 +03:00
Sebastian Schmidt
77659b8181 Add more string comparison test cases. 2021-07-13 15:06:43 +03:00
Sebastian Schmidt
97c5fc1c21 Add tests for evaluating operator tree and fix correct error for eval_number functions. 2021-07-13 14:55:23 +03:00
Sebastian Schmidt
e80fd20804 Increase test coverage and fix wrong error in shortcut method. 2021-07-13 14:28:25 +03:00
Sebastian Schmidt
8b493be1dd Increase test coverage.
Implement more tests and exclude modules from test that do not make sense to be tested.
2021-07-13 13:41:16 +03:00
Sebastian Schmidt
7ebf7e61d5 Increase test coverage.
Implement more tests and exclude modules from test that do not make sense to be tested.
2021-07-13 13:39:47 +03:00
Sebastian Schmidt
6a30bd24e2 Format code. 2021-06-22 11:43:58 +02:00
Sebastian Schmidt
bd9a314baa Increase test coverage. 2021-06-22 11:41:51 +02:00
Edwin Svensson
a25b347c17
fix tests 2021-05-31 01:15:01 +02:00
Edwin Svensson
8491bc61fc
add common math functions 2021-05-30 08:52:28 +02:00
Sebastian Schmidt
bee98999db Make Function clone.
To achieve this, the function type wrapped by Function was changed to remove the `Box`.

Relates to #73
2021-05-28 14:12:26 +03:00
Sebastian Schmidt
1316ae63d0 Update code formatting. 2021-05-28 08:56:21 +03:00
Sebastian Schmidt
782f233d7d Add more string comparison tests
Relates to #68
2019-08-30 12:43:10 +03:00