Natively handle negative numbers in tokenizer instead of the neg() function.

This commit is contained in:
Stephen Chung
2020-03-09 10:10:19 +08:00
parent c5b40783ef
commit 01d04f717b
3 changed files with 46 additions and 24 deletions

View File

@@ -21,7 +21,7 @@ fn test_math() -> Result<(), EvalAltResult> {
Err(EvalAltResult::ErrorArithmetic(_, _)) => (),
r => panic!("should return overflow error: {:?}", r),
}
match engine.eval::<i64>("(-9223372036854775807) - 2") {
match engine.eval::<i64>("-9223372036854775808 - 1") {
Err(EvalAltResult::ErrorArithmetic(_, _)) => (),
r => panic!("should return underflow error: {:?}", r),
}