Skip to content

Commit

Permalink
fixed some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Koss committed Nov 6, 2023
1 parent 7c251ab commit a9ea794
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ example:
go run ./example/main.go

test:
go test -race --parallel 8 ./...
go test -race -count=1 --parallel 8 ./...

get_coverage_pic:
gopherbadger -md="README.md,coverage.out"
2 changes: 1 addition & 1 deletion internal/algo/parallel/qsort/qsort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func rnd(n int) []int {
}

func Test_partition(t *testing.T) {
a := rnd(6000)
a := rnd(1000)
q := partition(a, 0, len(a)-1, func(a, b *int) bool { return *a < *b })
for i := 0; i <= q; i++ {
for j := q + 1; j < len(a); j++ {
Expand Down
35 changes: 2 additions & 33 deletions internal/internalpipe/mapfilterer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,12 @@ func Test_MapFilter(t *testing.T) {
ValLim: -1,
GoroutinesCnt: 1,
}
res := p.MapFilter(func(x int) (int, bool) { return x + 1, false }).
Do()
res := p.MapFilter(func(x int) (int, bool) { return x + 1, false }).Do()

require.Equal(t, 0, len(res))
})

t.Run("seven thread lim set", func(t *testing.T) {
t.Run("seven thread lim set empty", func(t *testing.T) {
p := Pipe[int]{
Fn: func(i int) (*int, bool) {
return &i, false
Expand All @@ -137,34 +136,4 @@ func Test_MapFilter(t *testing.T) {

require.Equal(t, 0, len(res))
})

t.Run("single thread ValLim set", func(t *testing.T) {
p := Pipe[int]{
Fn: func(i int) (*int, bool) {
return &i, false
},
Len: -1,
ValLim: len(exp),
GoroutinesCnt: 1,
}
res := p.MapFilter(func(x int) (int, bool) { return x + 1, false }).
Do()

require.Equal(t, 0, len(res))
})

t.Run("seven thread ValLim set", func(t *testing.T) {
p := Pipe[int]{
Fn: func(i int) (*int, bool) {
return &i, false
},
Len: -1,
ValLim: len(exp),
GoroutinesCnt: 7,
}
res := p.MapFilter(func(x int) (int, bool) { return x + 1, false }).
Do()

require.Equal(t, 0, len(res))
})
}

0 comments on commit a9ea794

Please sign in to comment.