-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [extract] Add support for multipleREs * [test] Remove support for go 1.11 * [cmd] Move options to the front of usage * log.DebugF => log.NoticeF
- Loading branch information
1 parent
61a95f8
commit 3e37155
Showing
5 changed files
with
104 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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}") | ||
} | ||
} |