(self, func, *args)
| 274 | input_shape = (800, 200) |
| 275 | |
| 276 | def _test_mtsame(self, func, *args): |
| 277 | def worker(args, q): |
| 278 | q.put(func(*args)) |
| 279 | |
| 280 | q = queue.Queue() |
| 281 | expected = func(*args) |
| 282 | |
| 283 | # Spin off a bunch of threads to call the same function simultaneously |
| 284 | t = [threading.Thread(target=worker, args=(args, q)) |
| 285 | for i in range(self.threads)] |
| 286 | [x.start() for x in t] |
| 287 | |
| 288 | [x.join() for x in t] |
| 289 | # Make sure all threads returned the correct value |
| 290 | for i in range(self.threads): |
| 291 | assert_array_equal(q.get(timeout=5), expected, |
| 292 | 'Function returned wrong value in multithreaded context') |
| 293 | |
| 294 | def test_fft(self): |
| 295 | a = np.ones(self.input_shape) * 1+0j |
no test coverage detected