blob: 77a7df0355f438fc907fb9121e2545b57c1ef83f [file] [log] [blame]
Lorenz Brunbd2ce6d2022-07-22 00:00:13 +00001package fat32
2
3import (
4 "encoding/binary"
5 "reflect"
6 "testing"
7)
8
9func TestStructureSizes(t *testing.T) {
10 cases := []struct {
11 StructInstance interface{}
12 ExpectedSize int
13 }{
14 {bootSector{}, 512},
15 {fsinfo{}, 512},
16 {dirEntry{}, 32},
17 {lfnEntry{}, 32},
18 }
19 for _, c := range cases {
20 t.Run(reflect.TypeOf(c.StructInstance).String(), func(t *testing.T) {
21 actualSize := binary.Size(c.StructInstance)
22 if actualSize != c.ExpectedSize {
23 t.Errorf("Expected %d bytes, got %d", c.ExpectedSize, actualSize)
24 }
25 })
26 }
27}