#3 updated encoding testcase to new usage

This commit is contained in:
Erik Ekman 2007-02-08 20:42:24 +00:00
parent 0e951ef007
commit a8127f410c

View File

@ -27,21 +27,19 @@ START_TEST(test_encoding_base32)
char temp[256]; char temp[256];
char *start = "HELLOTEST"; char *start = "HELLOTEST";
char *out = "1HELLOTEST"; char *out = "1HELLOTEST";
char *end; char end[256];
char *tempend; char *tempend;
int codedlength; int codedlength;
memset(temp, 0, sizeof(temp)); memset(temp, 0, sizeof(temp));
end = malloc(16); memset(end, 0, sizeof(end));
memset(end, 0, 16);
codedlength = encode_data(start, 9, 256, temp); codedlength = encode_data(start, strlen(start), sizeof(temp) - 1, temp + 1);
temp[0] = '1';
tempend = temp + strlen(temp); tempend = temp + strlen(temp);
decode_data(end, 16, temp, tempend); decode_data(end, sizeof(end), temp, tempend);
fail_unless(strcmp(out, end) == 0, NULL); fail_unless(strcmp(out, end) == 0, NULL);
free(end);
} }
END_TEST END_TEST