Skip to content

Instantly share code, notes, and snippets.

@borakasmer
Created August 18, 2020 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borakasmer/c69b8978f87d9421ed2e28d6f99f4b64 to your computer and use it in GitHub Desktop.
Save borakasmer/c69b8978f87d9421ed2e28d6f99f4b64 to your computer and use it in GitHub Desktop.
package concurrency
import "testing"
func TestConcurrency(t *testing.T){
testGroup := []struct{
max int
duration int
}{
{10,5},
{5,10},
{20,3},
{30,1},
{5,1},
{100,1},
{50,3},
}
for _,p := range testGroup{
c := startConcurrency(p.max,p.duration)
s := startSingle(p.max,p.duration)
if c*3 > s{
t.Errorf("Concurrency:%d, Single: %d",c,s)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment