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 13
20 char *input[NUM_TESTCASES]={"asdfABCDEFGHKL54",
24 "ASDFNERABHDFKHDFKLGJAHGLKAHGLKASHGEARNAKLVNLVAANLSADJVHASDLGH",
30 "ASDFASDFasdfasdfaBC\0AAAABBBBCCCC",
31 "ASDFASDFasdfasdfaBC0AAAABBBBCCCCmuhKA\0asASDFasdf" ,
34 int len[NUM_TESTCASES] = {16,
48 char *output_our, *output_ref;
49 char *input_our, *input_ref;
52 for(i = 0; i < NUM_TESTCASES; i++) {
53 input_our = strndup(input[i], len[i]);
54 input_ref = strndup(input[i], len[i]);
56 output_our = (char *) asmb((unsigned char *) input_our);
57 output_ref = (char *) asmb_ref((unsigned char *) input_ref);
58 if(memcmp(output_our,output_ref, len[i]) != 0) {
59 printf("Testfall%02i falsch!\n Input(\"%s\"):\n\t", i, input[i]);
60 for(j = 0; j <= len[i]; j++) {
61 printf("%02X ", input[i][j]);
63 printf("\nerwartet:\n\t");
64 for(j = 0; j <= len[i]; j++) {
65 printf("%02X ", output_ref[j]);
67 printf("\ntatsaechliches Ergebnis:\n\t");
68 for(j = 0; j <= len[i]; j++) {
69 printf("%02X ", output_our[j]);
74 printf("Testfall%02i korrekt\n", i);