Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Aug 8, 2021
1 parent 4531e0d commit 33c619a
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 66 deletions.
20 changes: 10 additions & 10 deletions uint16_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ func TestUint16Add(t *testing.T) {
}

func TestUint16Length(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint16()
s.Add(1)
s.Add(2)

is.Equal(s.Length(), 2)
is2.Equal(s.Length(), 2)
}
func TestUint16Deduplicate(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint16()
s.Add(1)
s.Add(2)
s.Add(2)
s.Add(2)

is.Equal(s.Length(), 4)
is.Equal(s.AsSlice(), []uint16{1, 2, 2, 2})
is2.Equal(s.Length(), 4)
is2.Equal(s.AsSlice(), []uint16{1, 2, 2, 2})
s.Deduplicate()
is.Equal(s.Length(), 2)
is.Equal(s.AsSlice(), []uint16{1, 2})
is2.Equal(s.Length(), 2)
is2.Equal(s.AsSlice(), []uint16{1, 2})
}
func TestUint16AddUnique(t *testing.T) {

Expand Down Expand Up @@ -171,13 +171,13 @@ func TestOptionalUint16Slice(t *testing.T) {

// TestUint16Sort tests that the slicer can be sorted
func TestUint16Sort(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
data := []uint16{5, 4, 3, 2, 1}
s := Uint16(data)
s.Sort()
result := s.Join(",")
expected := "1,2,3,4,5"
is.Equal(result, expected)
is2.Equal(result, expected)
s.Clear()
is.Equal(s.Join(""), "")
is2.Equal(s.Join(""), "")
}
20 changes: 10 additions & 10 deletions uint32_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,27 @@ func TestUint32AddSlice(t *testing.T) {
}

func TestUint32Length(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint32()
s.Add(1)
s.Add(2)

is.Equal(s.Length(), 2)
is2.Equal(s.Length(), 2)
}

func TestUint32Deduplicate(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint32()
s.Add(1)
s.Add(2)
s.Add(2)
s.Add(2)

is.Equal(s.Length(), 4)
is.Equal(s.AsSlice(), []uint32{1, 2, 2, 2})
is2.Equal(s.Length(), 4)
is2.Equal(s.AsSlice(), []uint32{1, 2, 2, 2})
s.Deduplicate()
is.Equal(s.Length(), 2)
is.Equal(s.AsSlice(), []uint32{1, 2})
is2.Equal(s.Length(), 2)
is2.Equal(s.AsSlice(), []uint32{1, 2})

}
func TestUint32AddSlicer(t *testing.T) {
Expand Down Expand Up @@ -174,13 +174,13 @@ func TestOptionalUint32Slice(t *testing.T) {

// TestUint32Sort tests that the slicer can be sorted
func TestUint32Sort(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
data := []uint32{5, 4, 3, 2, 1}
s := Uint32(data)
s.Sort()
result := s.Join(",")
expected := "1,2,3,4,5"
is.Equal(expected, result)
is2.Equal(expected, result)
s.Clear()
is.Equal(s.Join(""), "")
is2.Equal(s.Join(""), "")
}
20 changes: 10 additions & 10 deletions uint64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,37 +147,37 @@ func TestOptionalUint64Slice(t *testing.T) {
}
}
func TestUint64Deduplicate(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint64()
s.Add(1)
s.Add(2)
s.Add(2)
s.Add(2)

is.Equal(s.Length(), 4)
is.Equal(s.AsSlice(), []uint64{1, 2, 2, 2})
is2.Equal(s.Length(), 4)
is2.Equal(s.AsSlice(), []uint64{1, 2, 2, 2})
s.Deduplicate()
is.Equal(s.Length(), 2)
is.Equal(s.AsSlice(), []uint64{1, 2})
is2.Equal(s.Length(), 2)
is2.Equal(s.AsSlice(), []uint64{1, 2})
}
func TestUint64Length(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint64()
s.Add(1)
s.Add(2)

is.Equal(s.Length(), 2)
is2.Equal(s.Length(), 2)
}

// TestUint64Sort tests that the slicer can be sorted
func TestUint64Sort(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
data := []uint64{5, 4, 3, 2, 1}
s := Uint64(data)
s.Sort()
result := s.Join(",")
expected := "1,2,3,4,5"
is.Equal(expected, result)
is2.Equal(expected, result)
s.Clear()
is.Equal(s.Join(""), "")
is2.Equal(s.Join(""), "")
}
52 changes: 26 additions & 26 deletions uint8_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,62 @@ import (

func TestUint8Add(t *testing.T) {

is := is.New(t)
is2 := is.New(t)
s := Uint8()
s.Add(1)
s.Add(2)

is.Equal(s.AsSlice(), []uint8{1, 2})
is2.Equal(s.AsSlice(), []uint8{1, 2})

s.Clear()
s.Add(1, 2)

is.Equal(s.AsSlice(), []uint8{1, 2})
is2.Equal(s.AsSlice(), []uint8{1, 2})

}

func TestUint8Length(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint8()
s.Add(1)
s.Add(2)

is.Equal(s.Length(), 2)
is2.Equal(s.Length(), 2)
}

func TestUint8AddUnique(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint8()
s.AddUnique(1)
s.AddUnique(2)
s.AddUnique(2)
s.AddUnique(2)

is.Equal(s.AsSlice(), []uint8{1, 2})
is2.Equal(s.AsSlice(), []uint8{1, 2})

s.Clear()
s.AddUnique(1, 2, 1, 2, 2, 1)

is.Equal(s.AsSlice(), []uint8{1, 2})
is2.Equal(s.AsSlice(), []uint8{1, 2})
}

func TestUint8Deduplicate(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint8()
s.Add(1)
s.Add(2)
s.Add(2)
s.Add(2)

is.Equal(s.Length(), 4)
is.Equal(s.AsSlice(), []uint8{1, 2, 2, 2})
is2.Equal(s.Length(), 4)
is2.Equal(s.AsSlice(), []uint8{1, 2, 2, 2})
s.Deduplicate()
is.Equal(s.Length(), 2)
is.Equal(s.AsSlice(), []uint8{1, 2})
is2.Equal(s.Length(), 2)
is2.Equal(s.AsSlice(), []uint8{1, 2})
}

func TestUint8AddSlice(t *testing.T) {
is := is.New(t)
is2 := is.New(t)

s := Uint8()
s.Add(1)
Expand All @@ -71,12 +71,12 @@ func TestUint8AddSlice(t *testing.T) {
extras := []uint8{3, 4}

s.AddSlice(extras)
is.Equal(s.AsSlice(), []uint8{1, 2, 3, 4})
is2.Equal(s.AsSlice(), []uint8{1, 2, 3, 4})
}

func TestUint8AddSlicer(t *testing.T) {

is := is.New(t)
is2 := is.New(t)

s := Uint8()
s.Add(1)
Expand All @@ -88,12 +88,12 @@ func TestUint8AddSlicer(t *testing.T) {

s.AddSlicer(p)

is.Equal(s.AsSlice(), []uint8{1, 2, 3, 4})
is2.Equal(s.AsSlice(), []uint8{1, 2, 3, 4})
}

func TestUint8Filter(t *testing.T) {

is := is.New(t)
is2 := is.New(t)
s := Uint8()
s.Add(18)
s.Add(120)
Expand All @@ -107,13 +107,13 @@ func TestUint8Filter(t *testing.T) {
return i > 19
})

is.Equal(result.AsSlice(), []uint8{120, 20, 29})
is2.Equal(result.AsSlice(), []uint8{120, 20, 29})

}

func TestUint8Each(t *testing.T) {

is := is.New(t)
is2 := is.New(t)
s := Uint8()
s.Add(18)
s.Add(10)
Expand All @@ -129,13 +129,13 @@ func TestUint8Each(t *testing.T) {
result = result + i
})
var expected uint8 = 91
is.Equal(result, expected)
is2.Equal(result, expected)
}

// TestOptionalUint8Slice tests when you construct a Uint8 with
// an existing slice
func TestOptionalUint8Slice(t *testing.T) {
is := is.New(t)
is2 := is.New(t)

data := []uint8{1, 2, 3}
s := Uint8(data)
Expand All @@ -145,20 +145,20 @@ func TestOptionalUint8Slice(t *testing.T) {
result += elem
})
var expected uint8 = 6
is.Equal(result, expected)
is2.Equal(result, expected)

}

// TestUint8Sort tests that the slicer can be sorted
func TestUint8Sort(t *testing.T) {
is := is.New(t)
is2 := is.New(t)

data := []uint8{5, 4, 3, 2, 1}
s := Uint8(data)
s.Sort()
result := s.Join(",")
expected := "1,2,3,4,5"
is.Equal(result, expected)
is2.Equal(result, expected)
s.Clear()
is.Equal(s.Join(""), "")
is2.Equal(s.Join(""), "")
}
20 changes: 10 additions & 10 deletions uint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ func TestUintAdd(t *testing.T) {
}
}
func TestUintDeduplicate(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint()
s.Add(1)
s.Add(2)
s.Add(2)
s.Add(2)

is.Equal(s.Length(), 4)
is.Equal(s.AsSlice(), []uint{1, 2, 2, 2})
is2.Equal(s.Length(), 4)
is2.Equal(s.AsSlice(), []uint{1, 2, 2, 2})
s.Deduplicate()
is.Equal(s.Length(), 2)
is.Equal(s.AsSlice(), []uint{1, 2})
is2.Equal(s.Length(), 2)
is2.Equal(s.AsSlice(), []uint{1, 2})
}

func TestUintLength(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
s := Uint()
s.Add(1)
s.Add(2)

is.Equal(s.Length(), 2)
is2.Equal(s.Length(), 2)
}

func TestUintAddUnique(t *testing.T) {
Expand Down Expand Up @@ -151,13 +151,13 @@ func TestOptionalUintSlice(t *testing.T) {

// TestUintSort tests that the slicer can be sorted
func TestUintSort(t *testing.T) {
is := is.New(t)
is2 := is.New(t)
data := []uint{5, 4, 3, 2, 1}
s := Uint(data)
s.Sort()
result := s.Join(",")
expected := "1,2,3,4,5"
is.Equal(expected, result)
is2.Equal(expected, result)
s.Clear()
is.Equal(s.Join(""), "")
is2.Equal(s.Join(""), "")
}

0 comments on commit 33c619a

Please sign in to comment.