-
Notifications
You must be signed in to change notification settings - Fork 12
/
extract_test.go
36 lines (32 loc) · 888 Bytes
/
extract_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* extract_test.go
* allhic
*
* Created by Haibao Tang on 12/11/19
* Copyright © 2019 Haibao Tang. All rights reserved.
*/
package allhic_test
import (
"github.com/tanghaibao/allhic"
"testing"
)
func TestCountSimplePattern(t *testing.T) {
pattern := "GATC"
seq := []byte("GATCGATCGATC")
simplePattern := allhic.MakePattern(pattern)
got := allhic.CountPattern(seq, simplePattern)
expected := 3
if got != expected {
t.Errorf("CountPattern(#{seq}, #{pattern})=#{got}; want #{expected}")
}
}
func TestCountRegexPattern(t *testing.T) {
pattern := "GATCGATC,GANTGATC,GANTANTC,GATCANTC"
seq := []byte("GATCGATCGGACTGATCGACCGATCACTCACGCTAAATGCAGAATCGATTATTC")
regexPattern := allhic.MakePattern(pattern)
got := allhic.CountPattern(seq, regexPattern)
expected := 4
if got != expected {
t.Errorf("CountPattern(#{seq}, #{pattern})=#{got}; want #{expected}")
}
}