Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix: formatting

  • Loading branch information...
commit e6721fec5e8324f38837f1250b68c4728af137a7 1 parent 1702193
egon authored
View
24 src/spexs/sets_test.go
@@ -11,12 +11,12 @@ func TestHashSet(t *testing.T) {
hs := NewHashSet(10)
good := map[p]bool{
- p{0, 0}: true,
- p{13, 1}: true,
- p{14, 2}: true,
- p{1025235, 3}: true,
- p{2000, 15}: true,
- p{200000, 30}: true,
+ p{0, 0}: true,
+ p{13, 1}: true,
+ p{14, 2}: true,
+ p{1025235, 3}: true,
+ p{2000, 15}: true,
+ p{200000, 30}: true,
}
for pos := range good {
@@ -30,12 +30,12 @@ func TestHashSet(t *testing.T) {
}
invalid := map[p]bool{
- p{10, 0}: true,
- p{15, 0}: true,
- p{20, 3}: true,
- p{102535, 53}: true,
- p{2001, 63}: true,
- p{2000300, 41}: true,
+ p{10, 0}: true,
+ p{15, 0}: true,
+ p{20, 3}: true,
+ p{102535, 53}: true,
+ p{2001, 63}: true,
+ p{2000300, 41}: true,
}
for pos := range invalid {
View
12 src/spexs/spexs.go
@@ -16,7 +16,7 @@ type Patterns chan Pattern
type Reference interface {
Next(idx int, pos byte) (Char, byte, bool)
-}
+}
type Pooler interface {
Take() (Pattern, bool)
@@ -45,7 +45,7 @@ func NewPatterns() Patterns {
return make(Patterns, patternsBufferSize)
}
-func Run(s Setup){
+func Run(s Setup) {
for {
p, valid := s.In.Take()
if !valid {
@@ -64,12 +64,12 @@ func Run(s Setup){
}
}
-func RunParallel(s Setup, routines int){
+func RunParallel(s Setup, routines int) {
stop := make(chan int, routines)
for i := 0; i < routines; i += 1 {
- go func(s Setup){
- defer func(){ stop <- 1}()
+ go func(s Setup) {
+ defer func() { stop <- 1 }()
Run(s)
}(s)
}
@@ -77,4 +77,4 @@ func RunParallel(s Setup, routines int){
for i := 0; i < routines; i += 1 {
<-stop
}
-}
+}
View
2  src/spexs/trie/extenders.go
@@ -108,7 +108,7 @@ func StarExtender(node *Pattern, ref *Reference) Patterns {
output(result, patterns)
output(result, stars)
-
+
close(result)
return result
}
View
2  src/spexs/trie/pattern_test.go
@@ -24,7 +24,7 @@ func add(base *Pattern, s string) *Pattern {
func TestTrieNodeString(t *testing.T) {
root := pat("")
-
+
a := add(root, "hello")
b := add(a, " world")
c := add(root, "hello mXgic")
View
10 src/spexs/trie/spexs.go
@@ -35,7 +35,7 @@ func NewPatterns() Patterns {
return make(Patterns, patternsBufferSize)
}
-func Run(s Setup){
+func Run(s Setup) {
for {
p, valid := s.In.Take()
if !valid {
@@ -54,12 +54,12 @@ func Run(s Setup){
}
}
-func RunParallel(s Setup, routines int){
+func RunParallel(s Setup, routines int) {
stop := make(chan int, routines)
for i := 0; i < routines; i += 1 {
- go func(s Setup){
- defer func(){ stop <- 1}()
+ go func(s Setup) {
+ defer func() { stop <- 1 }()
Run(s)
}(s)
}
@@ -67,4 +67,4 @@ func RunParallel(s Setup, routines int){
for i := 0; i < routines; i += 1 {
<-stop
}
-}
+}
View
2  src/spxs/filters.go
@@ -15,7 +15,7 @@ func trueFilter(p *Pattern, ref *Reference) bool {
return true
}
-var Filters = map[string] filterCreator {
+var Filters = map[string]filterCreator{
"length": func(conf filterConf) FilterFunc {
return genericFilter(func(p *Pattern, ref *Reference) float64 {
return float64(p.Len())
View
19 src/stats/stats_test.go
@@ -1,8 +1,8 @@
package stats
import (
- "testing"
"math"
+ "testing"
)
const epsilon = 0.000001
@@ -25,26 +25,25 @@ func BenchmarkGamma(b *testing.B) {
benchGamma(b, HypergeometricSplit)
}
-
-type gammaTest struct {
+type gammaTest struct {
o, O, r, R int
- result float64
+ result float64
}
func testGamma(t *testing.T, fn gammaFunc) {
// verification result was calculated with
// binomial(O, o) * binomial(R, r)/binomial(O+R, o+r)
- tests := [...] gammaTest{
- {2,5, 2,10, 30.0/91.0},
- {2,45, 9,40, 71632.0/5645577.0},
+ tests := [...]gammaTest{
+ {2, 5, 2, 10, 30.0 / 91.0},
+ {2, 45, 9, 40, 71632.0 / 5645577.0},
}
for i, test := range tests {
p := fn(test.o, test.r, test.O, test.R)
p2 := fn(test.r, test.o, test.R, test.O) // since the test must be symmetric
-
- if math.Abs(p - test.result) > epsilon || math.Abs(p2 - test.result) > epsilon {
+
+ if math.Abs(p-test.result) > epsilon || math.Abs(p2-test.result) > epsilon {
t.Errorf("fail %v: got (%v, %v), expected %v, \nerr=(%v,%v)", i, p, p2, test.result, math.Abs(p-test.result), math.Abs(p2-test.result))
}
}
@@ -56,4 +55,4 @@ func TestLogGamma(t *testing.T) {
func TestGamma(t *testing.T) {
testGamma(t, HypergeometricSplit)
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.