blob: f361a897ae5c364ebe6bc6b6507b684cfc96a873 [file] [log] [blame]
Tim Windelschmidt6d33a432025-02-04 14:34:25 +01001// Copyright The Monogon Project Authors.
2// SPDX-License-Identifier: Apache-2.0
3
Lorenz Brunbd2ce6d2022-07-22 00:00:13 +00004package fat32
5
6import (
7 "encoding/binary"
8 "reflect"
9 "testing"
10)
11
12func TestStructureSizes(t *testing.T) {
13 cases := []struct {
14 StructInstance interface{}
15 ExpectedSize int
16 }{
17 {bootSector{}, 512},
18 {fsinfo{}, 512},
19 {dirEntry{}, 32},
20 {lfnEntry{}, 32},
21 }
22 for _, c := range cases {
23 t.Run(reflect.TypeOf(c.StructInstance).String(), func(t *testing.T) {
24 actualSize := binary.Size(c.StructInstance)
25 if actualSize != c.ExpectedSize {
26 t.Errorf("Expected %d bytes, got %d", c.ExpectedSize, actualSize)
27 }
28 })
29 }
30}