1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00
gopher-os/kernel/mem/pmm/frame_test.go
2017-05-31 17:02:34 +01:00

27 lines
624 B
Go

package pmm
import (
"testing"
"github.com/achilleasa/gopher-os/kernel/mem"
)
func TestFrameMethods(t *testing.T) {
for frameIndex := uint64(0); frameIndex < 128; frameIndex++ {
frame := Frame(frameIndex)
if !frame.Valid() {
t.Errorf("expected frame %d to be valid", frameIndex)
}
if exp, got := uintptr(frameIndex<<mem.PageShift), frame.Address(); got != exp {
t.Errorf("expected frame (%d, index: %d) call to Address() to return %x; got %x", frame, frameIndex, exp, got)
}
}
invalidFrame := InvalidFrame
if invalidFrame.Valid() {
t.Error("expected InvalidFrame.Valid() to return false")
}
}