Parse a file with test values -- starts a comment blank lines, or lines containing only a comment, are ignored other lines are expected to have the form id fn arg -> expected [flag]*
(fname)
| 74 | return fmt.format(abs_error, ulp_error, abs_tol, ulp_tol) |
| 75 | |
| 76 | def parse_mtestfile(fname): |
| 77 | """Parse a file with test values |
| 78 | |
| 79 | -- starts a comment |
| 80 | blank lines, or lines containing only a comment, are ignored |
| 81 | other lines are expected to have the form |
| 82 | id fn arg -> expected [flag]* |
| 83 | |
| 84 | """ |
| 85 | with open(fname, encoding="utf-8") as fp: |
| 86 | for line in fp: |
| 87 | # strip comments, and skip blank lines |
| 88 | if '--' in line: |
| 89 | line = line[:line.index('--')] |
| 90 | if not line.strip(): |
| 91 | continue |
| 92 | |
| 93 | lhs, rhs = line.split('->') |
| 94 | id, fn, arg = lhs.split() |
| 95 | rhs_pieces = rhs.split() |
| 96 | exp = rhs_pieces[0] |
| 97 | flags = rhs_pieces[1:] |
| 98 | |
| 99 | yield (id, fn, float(arg), float(exp), flags) |
| 100 | |
| 101 | |
| 102 | def parse_testfile(fname): |
no test coverage detected
searching dependent graphs…