Parse a file with test values Empty lines or lines starting with -- are ignored yields id, fn, arg_real, arg_imag, exp_real, exp_imag
(fname)
| 100 | |
| 101 | |
| 102 | def parse_testfile(fname): |
| 103 | """Parse a file with test values |
| 104 | |
| 105 | Empty lines or lines starting with -- are ignored |
| 106 | yields id, fn, arg_real, arg_imag, exp_real, exp_imag |
| 107 | """ |
| 108 | with open(fname, encoding="utf-8") as fp: |
| 109 | for line in fp: |
| 110 | # skip comment lines and blank lines |
| 111 | if line.startswith('--') or not line.strip(): |
| 112 | continue |
| 113 | |
| 114 | lhs, rhs = line.split('->') |
| 115 | id, fn, arg_real, arg_imag = lhs.split() |
| 116 | rhs_pieces = rhs.split() |
| 117 | exp_real, exp_imag = rhs_pieces[0], rhs_pieces[1] |
| 118 | flags = rhs_pieces[2:] |
| 119 | |
| 120 | yield (id, fn, |
| 121 | float(arg_real), float(arg_imag), |
| 122 | float(exp_real), float(exp_imag), |
| 123 | flags) |
| 124 | |
| 125 | |
| 126 | def result_check(expected, got, ulp_tol=5, abs_tol=0.0): |
no test coverage detected
searching dependent graphs…