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)
| 149 | |
| 150 | |
| 151 | def parse_testfile(fname): |
| 152 | """Parse a file with test values |
| 153 | |
| 154 | Empty lines or lines starting with -- are ignored |
| 155 | yields id, fn, arg_real, arg_imag, exp_real, exp_imag |
| 156 | """ |
| 157 | with open(fname, encoding="utf-8") as fp: |
| 158 | for line in fp: |
| 159 | # skip comment lines and blank lines |
| 160 | if line.startswith('--') or not line.strip(): |
| 161 | continue |
| 162 | |
| 163 | lhs, rhs = line.split('->') |
| 164 | id, fn, arg_real, arg_imag = lhs.split() |
| 165 | rhs_pieces = rhs.split() |
| 166 | exp_real, exp_imag = rhs_pieces[0], rhs_pieces[1] |
| 167 | flags = rhs_pieces[2:] |
| 168 | |
| 169 | yield (id, fn, |
| 170 | float(arg_real), float(arg_imag), |
| 171 | float(exp_real), float(exp_imag), |
| 172 | flags) |
| 173 | |
| 174 | |
| 175 | def result_check(expected, got, ulp_tol=5, abs_tol=0.0): |
no test coverage detected