super_block_test.go 483 B

12345678910111213141516171819202122232425
  1. package super_block
  2. import (
  3. "testing"
  4. "github.com/seaweedfs/seaweedfs/weed/storage/needle"
  5. )
  6. func TestSuperBlockReadWrite(t *testing.T) {
  7. rp, _ := NewReplicaPlacementFromByte(byte(001))
  8. ttl, _ := needle.ReadTTL("15d")
  9. s := &SuperBlock{
  10. Version: needle.CurrentVersion,
  11. ReplicaPlacement: rp,
  12. Ttl: ttl,
  13. }
  14. bytes := s.Bytes()
  15. if !(bytes[2] == 15 && bytes[3] == needle.Day) {
  16. println("byte[2]:", bytes[2], "byte[3]:", bytes[3])
  17. t.Fail()
  18. }
  19. }