Created
August 18, 2020 20:28
-
-
Save borakasmer/c69b8978f87d9421ed2e28d6f99f4b64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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