package s19_test import ( "fmt" "testing" "git.cheetah.cat/cheetah/moto-flash-data/s19" "github.com/rs/zerolog/log" ) func TestReadLuca(t *testing.T) { s19File, err := s19.NewS19Reader("../test-data/srec/luca.s19") if err != nil { t.Fatal(err) } defer s19File.Close() // records, err := s19File.ReadAllRecords() if err != nil { t.Fatal(err) } records = records[1:] // skip first ?? ranges := s19File.DetectAddressRanges(records) // for index, segment := range ranges { log.Info().Msg(fmt.Sprintf("Index: %d, Start: 0x%08X, End: 0x%08X, Size: %d bytes", index, segment.StartAddress, segment.EndAddress, segment.Size)) } if len(ranges) != 32 { t.Fail() } if ranges[31].Size != 13400 { t.Fail() } }