Skip to content

Commit

Permalink
fixed mash.NewMash to mash.New.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyStiles committed Oct 5, 2023
1 parent 2271b5d commit 5bd6a5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mash/mash.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ type Mash struct {
Sketches []uint32 // The sketches are the hashes of the kmers that we can compare to other sketches.
}

// NewMash initializes a new mash sketch.
func NewMash(kmerSize int, sketchSize int) *Mash {
// New initializes a new mash sketch.
func New(kmerSize int, sketchSize int) *Mash {
return &Mash{
KmerSize: kmerSize,
SketchSize: sketchSize,
Expand Down
8 changes: 4 additions & 4 deletions mash/mash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
)

func TestMash(t *testing.T) {
fingerprint1 := mash.NewMash(17, 10)
fingerprint1 := mash.New(17, 10)
fingerprint1.Sketch("ATGCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGA")

fingerprint2 := mash.NewMash(17, 9)
fingerprint2 := mash.New(17, 9)
fingerprint2.Sketch("ATGCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGA")

distance := fingerprint1.Distance(fingerprint2)
Expand All @@ -23,15 +23,15 @@ func TestMash(t *testing.T) {
t.Errorf("Expected distance to be 0, got %f", distance)
}

spoofedFingerprint := mash.NewMash(17, 10)
spoofedFingerprint := mash.New(17, 10)
spoofedFingerprint.Sketches[0] = 0

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

spoofedFingerprint = mash.NewMash(17, 9)
spoofedFingerprint = mash.New(17, 9)

distance = fingerprint1.Distance(spoofedFingerprint)
if distance != 1 {
Expand Down

0 comments on commit 5bd6a5d

Please sign in to comment.