diff --git a/include/unittest.h b/include/unittest.h index a58bbb937..bd355bb0c 100644 --- a/include/unittest.h +++ b/include/unittest.h @@ -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 diff --git a/libsrc/common/strcat.s b/libsrc/common/strcat.s index 279bfe65b..9be65386f 100644 --- a/libsrc/common/strcat.s +++ b/libsrc/common/strcat.s @@ -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 - diff --git a/testcode/lib/strcat-test.c b/testcode/lib/strcat-test.c index fdc987288..2e00b80cb 100644 --- a/testcode/lib/strcat-test.c +++ b/testcode/lib/strcat-test.c @@ -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 diff --git a/testcode/lib/strrchr-test.c b/testcode/lib/strrchr-test.c index 9c1c70032..d2c2a20e4 100644 --- a/testcode/lib/strrchr-test.c +++ b/testcode/lib/strrchr-test.c @@ -1,7 +1,7 @@ #include #include -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)