5 extern unsigned char *asmb(unsigned char *a);
7 unsigned char *asmb_ref(unsigned char *s)
10 for (i=0; s[i]; i++) {
12 c += (c>='A' && c<='Z') ? 'a'-'A' : 0;
18 #define NUM_TESTCASES 12
20 char *input[NUM_TESTCASES]={"asdfABCDEFGHKL54",
24 "ASDFNERABHDFKHDFKLGJAHGLKAHGLKASHGEARNAKLVNLVAANLSADJVHASDLGH",
30 "ASDFASDFasdfasdfaBC\0AAAABBBBCCCC",
31 "ASDFASDFasdfasdfaBC0AAAABBBBCCCCmuhKA\0asASDFasdf"
33 int len[NUM_TESTCASES] = {16,
46 char *output_our, *output_ref;
47 char *input_our, *input_ref;
50 for(i = 0; i < NUM_TESTCASES; i++) {
51 input_our = strndup(input[i], len[i]);
52 input_ref = strndup(input[i], len[i]);
54 output_our = asmb(input_our);
55 output_ref = asmb_ref(input_ref);
56 if(memcmp(output_our,output_ref, len[i]) != 0) {
57 printf("Testfall falsch! \n Input: \n");
58 for(j = 0; j <= len[i]; j++) {
59 printf("%02X ",input[j]);
61 printf("\nerwartet: \n");
62 for(j = 0; j <= len[i]; j++) {
63 printf("%02X ",output_ref[j]);
65 printf("\ntatsaechliches Ergebnis: \n");
66 for(j = 0; j <= len[i]; j++) {
67 printf("%02X ",output_our[j]);
72 printf("Testfall korrekt\n");