Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mash logic is wrong #108

Open
Koeng101 opened this issue Feb 17, 2025 · 0 comments
Open

mash logic is wrong #108

Koeng101 opened this issue Feb 17, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Koeng101
Copy link
Owner

In similarity:

if mash.SketchSize < other.SketchSize {
        largerSketch = other
        smallerSketch = mash
    }

But in the tests:

fingerprint1 = mash.New(17, 10, crc32.NewIEEE())
    fingerprint1.Sketch("ATGCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGA")

    fingerprint2 = mash.New(17, 5, crc32.NewIEEE())
    fingerprint2.Sketch("ATCGATCGATCGATCGATCGATCGATCGATCGATCGAATGCGATCGATCGATCGATCGATCG")

    distance = fingerprint1.Distance(fingerprint2)
    if !(distance > 0.19 && distance < 0.21) {
        t.Errorf("Expected distance to be 0.19999999999999996, got %f", distance)
    }

    fingerprint1 = mash.New(17, 10, crc32.NewIEEE())
    fingerprint1.Sketch("ATCGATCGATCGATCGATCGATCGATCGATCGATCGAATGCGATCGATCGATCGATCGATCG")

    fingerprint2 = mash.New(17, 5, crc32.NewIEEE())
    fingerprint2.Sketch("ATGCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGA")

    distance = fingerprint1.Distance(fingerprint2)
    if distance != 0 {
        t.Errorf("Expected distance to be 0, got %f", distance)
    }

Ordering shouldn't matter

@Koeng101 Koeng101 added the bug Something isn't working label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant