mirror of
https://github.com/cc65/cc65.git
synced 2025-01-15 22:30:04 +00:00
Fixed indentation
This commit is contained in:
parent
c240d42a9e
commit
3d28f5ca90
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2017 Christian Krueger */
|
||||
/* (C) 2017 Christian Krueger */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
@ -37,49 +37,49 @@
|
||||
#define COMMA ,
|
||||
#endif
|
||||
|
||||
#define TEST int main(void) \
|
||||
{\
|
||||
printf("%s: ",__FILE__);
|
||||
#define TEST int main(void) \
|
||||
{\
|
||||
printf("%s: ",__FILE__);
|
||||
|
||||
#define ENDTEST printf("Passed\n"); \
|
||||
return EXIT_SUCCESS; \
|
||||
}
|
||||
#define ENDTEST printf("Passed\n"); \
|
||||
return EXIT_SUCCESS; \
|
||||
}
|
||||
|
||||
#define ASSERT_IsTrue(a,b) if (!(a)) \
|
||||
{\
|
||||
printf("Fail at line %d:\n",__LINE__);\
|
||||
printf(b);\
|
||||
printf("\n");\
|
||||
printf("Expected status should be true but wasn't!\n");\
|
||||
exit(EXIT_FAILURE);\
|
||||
}
|
||||
#define ASSERT_IsTrue(a,b) if (!(a)) \
|
||||
{\
|
||||
printf("Fail at line %d:\n",__LINE__);\
|
||||
printf(b);\
|
||||
printf("\n");\
|
||||
printf("Expected status should be true but wasn't!\n");\
|
||||
exit(EXIT_FAILURE);\
|
||||
}
|
||||
|
||||
#define ASSERT_IsFalse(a,b) if ((a)) \
|
||||
{\
|
||||
printf("Fail at line %d:\n",__LINE__);\
|
||||
printf(b);\
|
||||
printf("\n");\
|
||||
printf("Expected status should be false but wasn't!\n");\
|
||||
exit(EXIT_FAILURE);\
|
||||
}
|
||||
#define ASSERT_IsFalse(a,b) if ((a)) \
|
||||
{\
|
||||
printf("Fail at line %d:\n",__LINE__);\
|
||||
printf(b);\
|
||||
printf("\n");\
|
||||
printf("Expected status should be false but wasn't!\n");\
|
||||
exit(EXIT_FAILURE);\
|
||||
}
|
||||
|
||||
#define ASSERT_AreEqual(a,b,c,d) if ((a) != (b)) \
|
||||
{\
|
||||
printf("Fail at line %d:\n",__LINE__);\
|
||||
printf(d);\
|
||||
printf("\n");\
|
||||
printf("Expected value: "c", but is "c"!\n", (a), (b));\
|
||||
exit(EXIT_FAILURE);\
|
||||
}
|
||||
#define ASSERT_AreEqual(a,b,c,d) if ((a) != (b)) \
|
||||
{\
|
||||
printf("Fail at line %d:\n",__LINE__);\
|
||||
printf(d);\
|
||||
printf("\n");\
|
||||
printf("Expected value: "c", but is "c"!\n", (a), (b));\
|
||||
exit(EXIT_FAILURE);\
|
||||
}
|
||||
|
||||
#define ASSERT_AreNotEqual(a,b,c,d) if ((a) == (b)) \
|
||||
{\
|
||||
printf("Fail at line %d:\n",__LINE__);\
|
||||
printf(d);\
|
||||
printf("\n");\
|
||||
printf("Expected value not: "c", but is "c"!\n", (a), (b));\
|
||||
exit(EXIT_FAILURE);\
|
||||
}
|
||||
#define ASSERT_AreNotEqual(a,b,c,d) if ((a) == (b)) \
|
||||
{\
|
||||
printf("Fail at line %d:\n",__LINE__);\
|
||||
printf(d);\
|
||||
printf("\n");\
|
||||
printf("Expected value not: "c", but is "c"!\n", (a), (b));\
|
||||
exit(EXIT_FAILURE);\
|
||||
}
|
||||
|
||||
/* End of unittest.h */
|
||||
#endif
|
||||
|
@ -10,38 +10,37 @@
|
||||
.importzp ptr1, ptr2, tmp3
|
||||
|
||||
_strcat:
|
||||
sta ptr1 ; Save src
|
||||
stx ptr1+1
|
||||
jsr popax ; Get dest
|
||||
sta tmp3 ; Remember for function return
|
||||
tay
|
||||
lda #0
|
||||
sta ptr2 ; access from page start, y contains low byte
|
||||
stx ptr2+1
|
||||
sta ptr1 ; Save src
|
||||
stx ptr1+1
|
||||
jsr popax ; Get dest
|
||||
sta tmp3 ; Remember for function return
|
||||
tay
|
||||
lda #0
|
||||
sta ptr2 ; access from page start, y contains low byte
|
||||
stx ptr2+1
|
||||
|
||||
findEndOfDest:
|
||||
lda (ptr2),y
|
||||
beq endOfDestFound
|
||||
lda (ptr2),y
|
||||
beq endOfDestFound
|
||||
iny
|
||||
bne findEndOfDest
|
||||
inc ptr2+1
|
||||
bne findEndOfDest
|
||||
bne findEndOfDest
|
||||
inc ptr2+1
|
||||
bne findEndOfDest
|
||||
|
||||
endOfDestFound:
|
||||
sty ptr2 ; advance pointer to last y position
|
||||
ldy #0 ; reset new y-offset
|
||||
sty ptr2 ; advance pointer to last y position
|
||||
ldy #0 ; reset new y-offset
|
||||
|
||||
copyByte:
|
||||
lda (ptr1),y
|
||||
sta (ptr2),y
|
||||
beq done
|
||||
lda (ptr1),y
|
||||
sta (ptr2),y
|
||||
beq done
|
||||
iny
|
||||
bne copyByte
|
||||
inc ptr1+1
|
||||
inc ptr2+1
|
||||
bne copyByte ; like bra here
|
||||
bne copyByte
|
||||
inc ptr1+1
|
||||
inc ptr2+1
|
||||
bne copyByte ; like bra here
|
||||
|
||||
; return pointer to dest
|
||||
done: lda tmp3 ; X does still contain high byte
|
||||
done: lda tmp3 ; X does still contain high byte
|
||||
rts
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#define SourceStringSize 257 // test correct page passing (>256)
|
||||
|
||||
static char SourceString[SourceStringSize+1]; // +1 room for terminating null
|
||||
static char SourceString[SourceStringSize+1]; // +1 room for terminating null
|
||||
static char DestinationString[2*SourceStringSize+1]; // will contain two times the source buffer
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ TEST
|
||||
unsigned position = j*SourceStringSize+i;
|
||||
unsigned current = DestinationString[position];
|
||||
unsigned expected = (i%128)+1;
|
||||
ASSERT_AreEqual(expected, current, "%u", "Unexpected destination buffer contents at position %u!\n" COMMA position);
|
||||
ASSERT_AreEqual(expected, current, "%u", "Unexpected destination buffer contents at position %u!\n" COMMA position);
|
||||
}
|
||||
}
|
||||
ENDTEST
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <unittest.h>
|
||||
#include <string.h>
|
||||
|
||||
static char TestString[] = "01234567890123456789"; // two times the same string
|
||||
static char TestString[] = "01234567890123456789"; // two times the same string
|
||||
static char Found[256];
|
||||
|
||||
TEST
|
||||
@ -10,7 +10,7 @@ TEST
|
||||
unsigned i;
|
||||
char* p;
|
||||
|
||||
len = strlen(TestString)/2; // test only one half of the string, to find last appearance
|
||||
len = strlen(TestString)/2; // test only one half of the string, to find last appearance
|
||||
|
||||
/* Search for all characters in the string, including the terminator */
|
||||
for (i = 0; i < len; ++i)
|
||||
|
Loading…
x
Reference in New Issue
Block a user