mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-13 15:33:17 +00:00
Add tests for primary, alternate functions
This commit is contained in:
parent
9cbfcac783
commit
c3b86031bd
@ -5,8 +5,8 @@
|
||||
#include "vm_bitfont.h"
|
||||
#include "vm_bits.h"
|
||||
|
||||
extern char apple2_text_alternate(char);
|
||||
extern char apple2_text_primary(char);
|
||||
extern char apple2_text_alternate(vm_8bit);
|
||||
extern char apple2_text_primary(vm_8bit);
|
||||
extern int apple2_text_area(vm_area *, vm_bitfont *, size_t);
|
||||
extern void apple2_text_draw(apple2 *, size_t);
|
||||
|
||||
|
@ -230,7 +230,7 @@ static char alternate_display[] = {
|
||||
* character code.
|
||||
*/
|
||||
char
|
||||
apple2_text_primary(char ch)
|
||||
apple2_text_primary(vm_8bit ch)
|
||||
{
|
||||
return primary_display[ch];
|
||||
}
|
||||
@ -240,7 +240,7 @@ apple2_text_primary(char ch)
|
||||
* character code.
|
||||
*/
|
||||
char
|
||||
apple2_text_alternate(char ch)
|
||||
apple2_text_alternate(vm_8bit ch)
|
||||
{
|
||||
return alternate_display[ch];
|
||||
}
|
||||
|
@ -46,3 +46,49 @@ Test(apple2_text, area)
|
||||
// yoff value I'm getting back is really out of whack, and I want to
|
||||
// do some more use-testing first
|
||||
}
|
||||
|
||||
Test(apple2_text, primary)
|
||||
{
|
||||
static char upper[] = {
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||
};
|
||||
|
||||
static char lower[] = {
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', ' ',
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(upper); i++) {
|
||||
cr_assert_eq(apple2_text_primary(i), upper[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(lower); i++) {
|
||||
cr_assert_eq(apple2_text_primary(i + 0xe0), lower[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Test(apple2_text, alternate)
|
||||
{
|
||||
static char upper[] = {
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||
};
|
||||
|
||||
static char lower[] = {
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', ' ',
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(upper); i++) {
|
||||
cr_assert_eq(apple2_text_alternate(i + 0x80), upper[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(lower); i++) {
|
||||
cr_assert_eq(apple2_text_alternate(i + 0x60), lower[i]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user