(N=1)
| 117 | |
| 118 | |
| 119 | def test_hamming(N=1): |
| 120 | np.random.seed(12345) |
| 121 | i = 0 |
| 122 | while i < N: |
| 123 | N = np.random.randint(1, 100) |
| 124 | x = (np.random.rand(N) * 100).round().astype(int) |
| 125 | y = (np.random.rand(N) * 100).round().astype(int) |
| 126 | mine = hamming(x, y) |
| 127 | theirs = scipy.spatial.distance.hamming(x, y) |
| 128 | np.testing.assert_almost_equal(mine, theirs) |
| 129 | print("PASSED") |
| 130 | i += 1 |
| 131 | |
| 132 | |
| 133 | def test_minkowski(N=1): |