mirror of
https://github.com/pevans/erc-c.git
synced 2025-01-18 10:30:37 +00:00
Add test for dec_dos
This commit is contained in:
parent
599b7c9212
commit
70b0532a26
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "apple2.dec.h"
|
#include "apple2.dec.h"
|
||||||
#include "apple2.enc.h"
|
#include "apple2.enc.h"
|
||||||
|
#include "apple2.dd.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ripped from apple2.enc.c
|
* Ripped from apple2.enc.c
|
||||||
@ -55,6 +56,22 @@ static vm_8bit f_enc_sector[] = {
|
|||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static vm_segment *seg;
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup()
|
||||||
|
{
|
||||||
|
seg = vm_segment_create(_140K_);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
teardown()
|
||||||
|
{
|
||||||
|
vm_segment_free(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
TestSuite(apple2_dec, .init = setup, .fini = teardown);
|
||||||
|
|
||||||
Test(apple2_dec, sector)
|
Test(apple2_dec, sector)
|
||||||
{
|
{
|
||||||
vm_segment *src, *dest;
|
vm_segment *src, *dest;
|
||||||
@ -94,3 +111,26 @@ Test(apple2_dec, track)
|
|||||||
vm_segment_get(orig, i));
|
vm_segment_get(orig, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Test(apple2_dec, dos)
|
||||||
|
{
|
||||||
|
vm_segment *enc;
|
||||||
|
vm_segment *dec;
|
||||||
|
FILE *fp = fopen("../../build/karateka.dsk", "r");
|
||||||
|
int i;
|
||||||
|
|
||||||
|
vm_segment_fread(seg, fp, 0, _140K_);
|
||||||
|
enc = apple2_enc_dos(seg);
|
||||||
|
dec = vm_segment_create(1000000);
|
||||||
|
|
||||||
|
apple2_dec_dos(dec, enc);
|
||||||
|
|
||||||
|
for (i = 0; i < seg->size; i++) {
|
||||||
|
cr_assert_eq(vm_segment_get(seg, i),
|
||||||
|
vm_segment_get(dec, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
vm_segment_free(enc);
|
||||||
|
vm_segment_free(dec);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user