mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
add some testing
This commit is contained in:
parent
9fe65223db
commit
dee9740e68
@ -77,6 +77,16 @@ func TestSetMode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestModeString(t *testing.T) {
|
||||
set := NewModeSet()
|
||||
set.SetMode('A', true)
|
||||
set.SetMode('z', true)
|
||||
|
||||
if modeString := set.String(); !(modeString == "Az" || modeString == "Za") {
|
||||
t.Errorf("unexpected modestring: %s", modeString)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNilReceivers(t *testing.T) {
|
||||
set := NewModeSet()
|
||||
set = nil
|
||||
@ -113,3 +123,16 @@ func TestHighestChannelUserMode(t *testing.T) {
|
||||
t.Errorf("nil modeset should have the zero mode as highest channel-user mode")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkModeString(b *testing.B) {
|
||||
set := NewModeSet()
|
||||
set.SetMode('A', true)
|
||||
set.SetMode('N', true)
|
||||
set.SetMode('b', true)
|
||||
set.SetMode('i', true)
|
||||
set.SetMode('x', true)
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = set.String()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user