10 type maskSuite struct{}
12 var _ = check.Suite(&maskSuite{})
14 func (s *maskSuite) TestMask(c *check.C) {
16 for i := 0; i < 1000000; i++ {
17 start := rand.Int() % 100000
18 end := rand.Int()%100000 + start
19 if start <= 9000 && end >= 8000 ||
20 start <= 8 && end >= 4 ||
24 m.Add("chr1", start, end)
26 m.Add("chr1", 1200, 3400)
27 m.Add("chr1", 5600, 7800)
28 m.Add("chr1", 5300, 7900)
29 m.Add("chr1", 9900, 9900)
35 c.Check(m.Check("chr1", 1, 1), check.Equals, true)
36 c.Check(m.Check("chr1", 4, 8), check.Equals, false)
37 c.Check(m.Check("chr1", 7800, 8000), check.Equals, true)
38 c.Check(m.Check("chr1", 8000, 9000), check.Equals, false)
39 c.Check(m.Check("chr1999", 1, 1), check.Equals, false)
42 func BenchmarkMask1000(b *testing.B) {
43 benchmarkMask(b, 1000)
46 func BenchmarkMask10000(b *testing.B) {
47 benchmarkMask(b, 10000)
50 func BenchmarkMask100000(b *testing.B) {
51 benchmarkMask(b, 100000)
54 func BenchmarkMask1000000(b *testing.B) {
55 benchmarkMask(b, 1000000)
58 func benchmarkMask(b *testing.B, size int) {
60 for i := 0; i < size; i++ {
61 start := rand.Int() % 10000000
62 end := rand.Int()%300 + start
63 m.Add("chrB", start, end)
66 for n := 0; n < b.N; n++ {
67 start := rand.Int() % 10000000
68 end := rand.Int()%300 + start
69 m.Check("chrB", start, end)