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
21 char *input[NUM_TESTCASES]={"asdfABCDEFGHKL54",
25 "ASDFNERABHDFKHDFKLGJAHGLKAHGLKASHGEARNAKLVNLVAANLSADJVHASDLGH",
31 "ASDFASDFasdfasdfaBC\0AAAABBBBCCCC",
32 "ASDFASDFasdfasdfaBC0AAAABBBBCCCCmuhKA\0asASDFasdf"
34 int len[NUM_TESTCASES] = {16,
47 char *output_our, *output_ref;
48 char *input_our, *input_ref;
51 for(i = 0; i < NUM_TESTCASES; i++) {
52 input_our = strndup(input[i], len[i]);
53 input_ref = strndup(input[i], len[i]);
55 output_our = (char *) asmb((unsigned char*) input_our);
56 output_ref = (char *) asmb_ref((unsigned char*) input_ref);
57 if(memcmp(output_our,output_ref, len[i]) != 0) {
58 printf("Testfall falsch!\nInput:\n\t");
59 for(j = 0; j <= len[i]; j++) {
60 printf("%02X ", input[i][j]);
62 printf("\nerwartet:\n\t");
63 for(j = 0; j <= len[i]; j++) {
64 printf("%02X ", output_ref[j]);
66 printf("\ntatsaechliches Ergebnis:\n\t");
67 for(j = 0; j <= len[i]; j++) {
68 printf("%02X ", output_our[j]);
73 printf("Testfall korrekt\n");