fix parse_frac bug for leading space leading to infinite recursion

This commit is contained in:
Adrian Mariano
2023-03-22 16:11:31 -04:00
parent 05eec08542
commit 654e3cd86a
2 changed files with 23 additions and 18 deletions

View File

@@ -215,6 +215,12 @@ module test_parse_frac() {
assert(parse_frac("3/0") == INF);
assert(parse_frac("-3/0") == -INF);
assert(is_nan(parse_frac("0/0")));
assert(is_nan(parse_frac("-77/9", improper=false)));
assert(is_nan(parse_frac("-2 12/4",improper=false)));
assert(is_nan(parse_frac("-2 12/4",signed=false)));
assert(is_nan(parse_frac("-2 12/4",mixed=false)));
assert(is_nan(parse_frac("2 1/4",mixed=false)));
assert(is_nan(parse_frac("2", mixed=false)));
}
test_parse_frac();