|
@@ 232-248 (lines=17) @@
|
| 229 |
|
self.fail('Exception "{}" thrown by {} for word: {}' |
| 230 |
|
.format(inst, algo, fuzzed)) |
| 231 |
|
|
| 232 |
|
def fuzz_test_100pct(self): |
| 233 |
|
"""Fuzz test phonetic algorithms against 100% fuzzed words.""" |
| 234 |
|
for _ in range(self.reps): |
| 235 |
|
fuzzed = fuzz(random.choice(self.basewords), fuzziness=1) |
| 236 |
|
|
| 237 |
|
if EXTREME_TEST: |
| 238 |
|
algs = list(algorithms.keys()) |
| 239 |
|
else: |
| 240 |
|
algs = random.choices(list(algorithms.keys()), k=5) |
| 241 |
|
|
| 242 |
|
for algo in algs: |
| 243 |
|
try: |
| 244 |
|
if not ('bmpm' in algo and len(fuzzed) > 12): |
| 245 |
|
algorithms[algo](fuzzed) |
| 246 |
|
except Exception as inst: |
| 247 |
|
self.fail('Exception "{}" thrown by {} for word: {}' |
| 248 |
|
.format(inst, algo, fuzzed)) |
| 249 |
|
|
| 250 |
|
def fuzz_test_fuzz_bmp(self): |
| 251 |
|
"""Fuzz test phonetic algorithms against BMP fuzz.""" |
|
@@ 214-230 (lines=17) @@
|
| 211 |
|
self.fail('Exception "{}" thrown by {} for word: {}' |
| 212 |
|
.format(inst, algo, word)) |
| 213 |
|
|
| 214 |
|
def fuzz_test_20pct(self): |
| 215 |
|
"""Fuzz test phonetic algorithms against 20% fuzzed words.""" |
| 216 |
|
for _ in range(self.reps): |
| 217 |
|
fuzzed = fuzz(random.choice(self.basewords), fuzziness=0.2) |
| 218 |
|
|
| 219 |
|
if EXTREME_TEST: |
| 220 |
|
algs = list(algorithms.keys()) |
| 221 |
|
else: |
| 222 |
|
algs = random.choices(list(algorithms.keys()), k=5) |
| 223 |
|
|
| 224 |
|
for algo in algs: |
| 225 |
|
try: |
| 226 |
|
if not ('bmpm' in algo and len(fuzzed) > 12): |
| 227 |
|
algorithms[algo](fuzzed) |
| 228 |
|
except Exception as inst: |
| 229 |
|
self.fail('Exception "{}" thrown by {} for word: {}' |
| 230 |
|
.format(inst, algo, fuzzed)) |
| 231 |
|
|
| 232 |
|
def fuzz_test_100pct(self): |
| 233 |
|
"""Fuzz test phonetic algorithms against 100% fuzzed words.""" |