refactor memory map related code

This commit is contained in:
Chris Lu
2019-10-22 00:49:42 -07:00
parent fec07c829d
commit c9a183eb69
6 changed files with 34 additions and 51 deletions

View File

@@ -1,14 +0,0 @@
package needle
import "strconv"
func ReadMemoryMapMaxSizeMb(MemoryMapMaxSizeMbString string) (uint32, error) {
if MemoryMapMaxSizeMbString == "" {
return 0, nil
}
var MemoryMapMaxSize64 uint64
var err error
MemoryMapMaxSize64, err = strconv.ParseUint(MemoryMapMaxSizeMbString, 10, 32)
MemoryMapMaxSize := uint32(MemoryMapMaxSize64)
return MemoryMapMaxSize, err
}

View File

@@ -1,10 +0,0 @@
package needle
import "testing"
func TestMemoryMapMaxSizeReadWrite(t *testing.T) {
memoryMapSize, _ := ReadMemoryMapMaxSizeMb("5000")
if memoryMapSize != 5000 {
t.Errorf("empty memoryMapSize:%v", memoryMapSize)
}
}