(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestHashForNoCollisions(t *testing.T) { |
| 13 | // Verify cases of known collisions under TokenFor don't collide in HashForTraceID. |
| 14 | pairs := [][2]string{ |
| 15 | {"fd5980503add11f09f80f77608c1b2da", "091ea7803ade11f0998a055186ee1243"}, |
| 16 | {"9e0d446036dc11f09ac04988d2097052", "a61ed97036dc11f0883771db3b51b1ec"}, |
| 17 | {"6b27f5501eda11f09e99db1b2c23c542", "6b4149b01eda11f0b0e2a966cf7ebbc8"}, |
| 18 | {"3e9582202f9a11f0afb01b7c06024bd6", "370db6802f9a11f0a9a212dff3125239"}, |
| 19 | {"978d70802a7311f0991f350653ef0ab4", "9b66da202a7311f09d292db17ccfd31a"}, |
| 20 | {"de567f703bb711f0b8c377682d1667e6", "dc2d0fc03bb711f091de732fcf93048c"}, |
| 21 | } |
| 22 | for _, pair := range pairs { |
| 23 | b1, _ := HexStringToTraceID(pair[0]) |
| 24 | b2, _ := HexStringToTraceID(pair[1]) |
| 25 | |
| 26 | t1 := HashForTraceID(b1) |
| 27 | t2 := HashForTraceID(b2) |
| 28 | |
| 29 | require.NotEqual(t, t1, t2) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // Verify HashForTraceID doesn't collide within reasonable numbers, and estimate the hash collision rate if it does. |
| 34 | func TestHashForCollisionRate(t *testing.T) { |
nothing calls this directly
no test coverage detected