mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-12-21 18:29:45 +00:00
26 lines
503 B
Go
26 lines
503 B
Go
package izapple2
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestNibBackAndForth(t *testing.T) {
|
|
// Init data
|
|
data := make([]byte, bytesPerTrack)
|
|
for i := 0; i < bytesPerTrack; i++ {
|
|
data[i] = byte(i % 100)
|
|
}
|
|
|
|
nib := nibEncodeTrack(data, 255, 0, &dos33SectorsLogicalOrder)
|
|
data2, err := nibDecodeTrack(nib, &dos33SectorsLogicalOrder)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
for i := 0; i < bytesPerTrack; i++ {
|
|
if data[i] != data2[i] {
|
|
t.Errorf("Mismatch in %v: %02x -> %02x", i, data[i], data2[i])
|
|
}
|
|
}
|
|
}
|