-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfixtures_test.go
More file actions
37 lines (31 loc) · 842 Bytes
/
fixtures_test.go
File metadata and controls
37 lines (31 loc) · 842 Bytes
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
37
package main
import (
"math/rand"
"time"
"github.com/go-ini/ini"
)
type numPair struct {
expected int
passed int
}
// Create a N long random string
func RandomString(strlen int) string {
rand.Seed(time.Now().UTC().UnixNano())
const chars = "abcdefghijklmnopqrstuvwxyz0123456789"
result := make([]byte, strlen)
for i := 0; i < strlen; i++ {
result[i] = chars[rand.Intn(len(chars))]
}
return string(result)
}
func empty_ini_section() *ini.Section {
i, _ := ini.Load([]byte(""))
i.DeleteSection(ini.DEFAULT_SECTION)
sec, _ := i.NewSection("fixture")
return sec
}
var testPriorities = []TestSyslogPriority{
{severity: logErr, facility: logMail, priority: SyslogPriority(19)},
{severity: logEmerg, facility: logKern, priority: SyslogPriority(0)},
{severity: logAlert, facility: logUser, priority: SyslogPriority(9)},
}