mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 10:10:08 -08:00
more memory-efficient implementation of line reading
This commit is contained in:
parent
12bcba01cd
commit
c78253fd93
6 changed files with 96 additions and 45 deletions
19
irc/utils/math_test.go
Normal file
19
irc/utils/math_test.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (c) 2020 Shivaram Lingamneni <slingamn@cs.stanford.edu>
|
||||
// released under the MIT license
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRoundUp(t *testing.T) {
|
||||
assertEqual(RoundUpToPowerOfTwo(2), 2, t)
|
||||
assertEqual(RoundUpToPowerOfTwo(3), 4, t)
|
||||
assertEqual(RoundUpToPowerOfTwo(64), 64, t)
|
||||
assertEqual(RoundUpToPowerOfTwo(65), 128, t)
|
||||
assertEqual(RoundUpToPowerOfTwo(100), 128, t)
|
||||
assertEqual(RoundUpToPowerOfTwo(1000), 1024, t)
|
||||
assertEqual(RoundUpToPowerOfTwo(1025), 2048, t)
|
||||
assertEqual(RoundUpToPowerOfTwo(269435457), 536870912, t)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue