mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Introduces failing test of Macintosh GCR data encoding.
This commit is contained in:
parent
fe0dc4df88
commit
745a5ab749
@ -16,7 +16,7 @@
|
||||
@implementation MacGCRTests {
|
||||
}
|
||||
|
||||
- (void)testSector0Track0Side0 {
|
||||
- (void)testSector0Track0Side0Header {
|
||||
const auto header = Storage::Encodings::AppleGCR::Macintosh::header(0x22, 0, 0, false);
|
||||
const std::vector<uint8_t> expected_mark = {
|
||||
0xd5, 0xaa, 0x96,
|
||||
@ -28,7 +28,7 @@
|
||||
XCTAssertEqual(mark_segment.data, header.data);
|
||||
}
|
||||
|
||||
- (void)testSector9Track11Side1 {
|
||||
- (void)testSector9Track11Side1Header {
|
||||
const auto header = Storage::Encodings::AppleGCR::Macintosh::header(0x22, 11, 9, true);
|
||||
const std::vector<uint8_t> expected_mark = {
|
||||
0xd5, 0xaa, 0x96,
|
||||
@ -40,4 +40,96 @@
|
||||
XCTAssertEqual(mark_segment.data, header.data);
|
||||
}
|
||||
|
||||
- (void)testData {
|
||||
// These bytes are taken from the PlusToo project's boot disk, courtesy of https://www.bigmessowires.com ;
|
||||
// this is the only example I've been able to find of a Macintosh disk that has already been converted
|
||||
// into GCR bytes.
|
||||
const std::vector<uint8_t> expected_data = {
|
||||
0xD5, 0xAA, 0xAD, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
|
||||
0x96, 0x96, 0x96, 0x96, 0xB4, 0xAE, 0xA6, 0xE7, 0xF6, 0x96, 0xAE, 0xAF, 0xDC, 0xAE, 0xCB, 0xD9,
|
||||
0x9D, 0xBE, 0xAD, 0xFB, 0xE6, 0xD7, 0xF4, 0xEC, 0xF4, 0xFD, 0x9F, 0xE5, 0xBA, 0xB7, 0xE9, 0xAB,
|
||||
0x9F, 0xA6, 0xAF, 0xE5, 0xE6, 0xEB, 0xEA, 0xEC, 0xBE, 0xEC, 0x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ears to be what the Macintosh places into memory when reading the above sector.
|
||||
const uint8_t source_data[524] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1c, 0x1b, 0x81,
|
||||
0x11, 0xe1, 0x0b, 0x50, 0x26, 0x2c, 0xd1, 0xc5, 0x36, 0x5f, 0x58, 0xdd, 0x26, 0x12, 0x61, 0xaf,
|
||||
0xe8, 0xbd, 0x7d, 0x4c, 0xba, 0x1a, 0x71, 0x9a, 0xa0, 0x40, 0x52, 0x74, 0x2d, 0x7f, 0x86, 0x02,
|
||||
0x20, 0xef, 0xbd, 0x52, 0x29, 0xeb, 0xd5, 0xd5, 0x88, 0x54, 0xe7, 0xb8, 0xe8, 0x2b, 0x65, 0x93,
|
||||
0x28, 0xd9, 0x01, 0x3e, 0x3c, 0x66, 0x8a, 0xbb, 0x39, 0x6d, 0x23, 0xc3, 0xad, 0x8c, 0xb2, 0x30,
|
||||
0x73, 0x5c, 0x38, 0x90, 0xca, 0xf4, 0x2e, 0x65, 0xaf, 0xa6, 0xe0, 0x4c, 0x18, 0x6c, 0x6a, 0xbd,
|
||||
0x30, 0x07, 0x62, 0x96, 0x3d, 0x2b, 0x41, 0xb1, 0x0d, 0x8b, 0x33, 0xed, 0x49, 0x38, 0xe0, 0x78,
|
||||
0x06, 0x9f, 0x72, 0xa0, 0xdf, 0x9b, 0xc9, 0x1f, 0xd5, 0x1f, 0xac, 0x39, 0x7f, 0x8f, 0x44, 0x13,
|
||||
0x64, 0xbb, 0x92, 0xdd, 0xec, 0xc5, 0xfd, 0xf0, 0xe5, 0xc9, 0x69, 0x34, 0x44, 0xbd, 0x0a, 0x89,
|
||||
0xb5, 0xc7, 0x91, 0x6b, 0x60, 0x73, 0x7f, 0xe1, 0x44, 0x75, 0xb6, 0xf6, 0x8e, 0xc5, 0xac, 0x91,
|
||||
0x0c, 0x34, 0xef, 0xa3, 0x74, 0xa1, 0xdc, 0x6f, 0xfb, 0x86, 0x66, 0x86, 0x13, 0xd3, 0x4b, 0xc1,
|
||||
0x61, 0x3f, 0x26, 0x05, 0x92, 0xe2, 0x90, 0xd6, 0xb2, 0x7d, 0x34, 0x20, 0x54, 0x80, 0xb7, 0xb3,
|
||||
0xdc, 0xe6, 0xc3, 0x67, 0xdc, 0xb2, 0x86, 0x2e, 0x92, 0x50, 0x90, 0xfc, 0x38, 0x7c, 0x97, 0x8f,
|
||||
0xc3, 0x45, 0x2e, 0x4d, 0xff, 0x06, 0x6b, 0x0c, 0xb9, 0xc1, 0x9c, 0xca, 0x04, 0x46, 0xa7, 0x44,
|
||||
0x93, 0xa2, 0xa5, 0xf7, 0x74, 0x85, 0x9c, 0x6f, 0x0c, 0x69, 0xc1, 0xc3, 0xc0, 0x50, 0x65, 0x66,
|
||||
0x99, 0xae, 0x68, 0xb9, 0x6f, 0x2f, 0x8c, 0xb3, 0x1f, 0x1b, 0xe8, 0x2f, 0x7f, 0x61, 0xd9, 0x06,
|
||||
0xee, 0xe9, 0xa2, 0xab, 0xd0, 0x31, 0xdf, 0x51, 0x58, 0xdf, 0x31, 0x09, 0x91, 0xdd, 0x81, 0x7f,
|
||||
0x32, 0xa9, 0xb6, 0x08, 0x73, 0x02, 0x93, 0xd8, 0x31, 0x70, 0x3c, 0xb3, 0x16, 0x82, 0x62, 0x06,
|
||||
0xf9, 0x75, 0xbf, 0xd6, 0xa4, 0x94, 0x0b, 0x07, 0x66, 0x46, 0x32, 0xb2, 0xf0, 0x38, 0x9f, 0xd7,
|
||||
0x1e, 0xfd, 0x69, 0x28, 0x08, 0x92, 0x92, 0xe7, 0xe4, 0xc8, 0xcc, 0x7f, 0xeb, 0x3b, 0xcd, 0xa5,
|
||||
0x86, 0xb8, 0xee, 0x2f, 0xc4, 0x49, 0x55, 0x4c, 0xba, 0xfb, 0x7a, 0xe8, 0xcf, 0x48, 0x32, 0x2e,
|
||||
0xf5, 0x8f, 0xa3, 0x27, 0x76, 0x04, 0x54, 0x1f, 0x2c, 0x2f, 0x14, 0xd9, 0xab, 0xaa, 0x0f, 0xf2,
|
||||
0x99, 0x72, 0x19, 0xa8, 0x27, 0xf3, 0xa2, 0xfc, 0x12, 0xdc, 0x49, 0x4c, 0x62, 0x84, 0x17, 0x32,
|
||||
0xd1, 0xde, 0x28, 0x87, 0xb0, 0x7e, 0xd9, 0x02, 0xce, 0xe8, 0x92, 0xad, 0x6d, 0x5e, 0x79, 0x9f,
|
||||
0xfc, 0x2c, 0xa5, 0x01, 0x1a, 0xc5, 0x4a, 0x93, 0x04, 0xcf, 0x6e, 0xd6, 0xa5, 0xa4, 0x68, 0x1d,
|
||||
0x8c, 0x91, 0xa4, 0x01, 0x21, 0x8c, 0xc9, 0x20, 0xd2, 0xc3, 0x6d, 0xed, 0x76, 0xea, 0x3a, 0x54,
|
||||
0xd4, 0xb5, 0x8d, 0x60, 0x7f, 0x61, 0xa1, 0x59, 0x53, 0xad, 0x59, 0xce, 0x6c, 0x67, 0x64, 0x86,
|
||||
0x4c, 0xea, 0x39, 0x6b, 0x14, 0x75, 0x7a, 0x75, 0xcd, 0x5c, 0xf1, 0x8d, 0xd9, 0x7d, 0x3e, 0x76,
|
||||
0x47, 0x66, 0x01, 0xf3, 0x40, 0x3d, 0x80, 0x29, 0xf1, 0x82, 0x85, 0xff, 0xab, 0xa0, 0x67, 0x26,
|
||||
0x8f, 0xb8, 0x9b, 0x5a, 0xb2, 0x64, 0x8d, 0xbe, 0xe3, 0xa4, 0x82, 0x44, 0xac, 0x1d, 0xae, 0x80,
|
||||
0x54, 0xac, 0x14, 0x0e, 0x63, 0x9a, 0x17, 0x4f, 0x1b, 0xf2, 0x02, 0x85, 0x34, 0x93, 0xab, 0x0e,
|
||||
0x09, 0x64, 0x18, 0x6e, 0x66, 0xd5, 0x32, 0x6f, 0xc2, 0x1e, 0x69, 0x75, 0x80, 0x4d, 0x9e, 0x92,
|
||||
0x5a, 0xee, 0xc1, 0x29, 0x41, 0xae, 0x47, 0xbd, 0x3b, 0x13, 0x46, 0xa1, // 0x00,
|
||||
};
|
||||
const auto data = Storage::Encodings::AppleGCR::Macintosh::data(source_data);
|
||||
const auto expected = Storage::Disk::PCMSegment(expected_data);
|
||||
XCTAssertEqual(data.data, expected.data);
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user