aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_util_format.c
diff options
context:
space:
mode:
authorOla Bini <ola@olabini.se>2015-10-03 18:46:40 -0500
committerOla Bini <ola@olabini.se>2015-10-03 18:46:40 -0500
commitb54133fbd9b1c7e08024b3987ff17ca3ef5666a9 (patch)
tree5a61ffb35984062be7da20b5aaf2b71dfb7685bd /src/test/test_util_format.c
parentd0abf16119cf57e47044e171bc310773b45686f6 (diff)
downloadtor-b54133fbd9b1c7e08024b3987ff17ca3ef5666a9.tar.gz
tor-b54133fbd9b1c7e08024b3987ff17ca3ef5666a9.zip
Fix spaces warnings
Diffstat (limited to 'src/test/test_util_format.c')
-rw-r--r--src/test/test_util_format.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/test/test_util_format.c b/src/test/test_util_format.c
index e35632f7e8..7be67438f5 100644
--- a/src/test/test_util_format.c
+++ b/src/test/test_util_format.c
@@ -23,7 +23,7 @@ test_util_format_base64_encode(void *ignored)
src = tor_malloc_zero(256);
dst = tor_malloc_zero(1000);
- for(i=0;i<256;i++) {
+ for (i=0;i<256;i++) {
src[i] = (char)i;
}
@@ -44,22 +44,35 @@ test_util_format_base64_encode(void *ignored)
res = base64_encode(dst, 1000, src, 256, 0);
tt_int_op(res, OP_EQ, 344);
- tt_str_op(dst, OP_EQ, "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==");
-
+ tt_str_op(dst, OP_E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
+ "kJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+w"
+ "sbKztLW2t7i5uru8vb6/\n"
+ "wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g"
+ "4eLj5OXm5+jp6uvs7e7v\n"
"8PHy8/T19vf4+fr7/P3+/w==\n");
res = base64_encode(dst, 1000, src+1, 255, BASE64_ENCODE_MULTILINE);
tt_int_op(res, OP_EQ, 346);
- for(i = 0;i<50;i++) {
+ for (i = 0;i<50;i++) {
src[i] = 0;
}
src[50] = 255;
@@ -94,7 +107,6 @@ test_util_format_base64_encode(void *ignored)
res = base64_encode(dst, 1000, src+8, 46, BASE64_ENCODE_MULTILINE);
tt_int_op(res, OP_EQ, 65);
-
done:
tor_free(src);
tor_free(dst);
@@ -115,7 +127,7 @@ test_util_format_base64_decode_nopad(void *ignored)
dst = tor_malloc_zero(1000);
real_dst = tor_malloc_zero(10);
- for(i=0;i<256;i++) {
+ for (i=0;i<256;i++) {
src[i] = (char)i;
}
@@ -135,7 +147,6 @@ test_util_format_base64_decode_nopad(void *ignored)
tor_free(real_dst);
}
-
static void
test_util_format_base64_decode(void *ignored)
{
@@ -151,7 +162,7 @@ test_util_format_base64_decode(void *ignored)
dst = tor_malloc_zero(1000);
real_dst = tor_malloc_zero(10);
- for(i=0;i<256;i++) {
+ for (i=0;i<256;i++) {
src[i] = (char)i;
}
@@ -171,8 +182,6 @@ test_util_format_base64_decode(void *ignored)
tor_free(real_dst);
}
-
-
static void
test_util_format_base16_decode(void *ignored)
{
@@ -188,7 +197,7 @@ test_util_format_base16_decode(void *ignored)
dst = tor_malloc_zero(1000);
real_dst = tor_malloc_zero(10);
- for(i=0;i<256;i++) {
+ for (i=0;i<256;i++) {
src[i] = (char)i;
}
@@ -211,10 +220,10 @@ test_util_format_base16_decode(void *ignored)
tor_free(real_dst);
}
-
struct testcase_t util_format_tests[] = {
{ "base64_encode", test_util_format_base64_encode, 0, NULL, NULL },
- { "base64_decode_nopad", test_util_format_base64_decode_nopad, 0, NULL, NULL },
+ { "base64_decode_nopad", test_util_format_base64_decode_nopad,
+ 0, NULL, NULL },
{ "base64_decode", test_util_format_base64_decode, 0, NULL, NULL },
{ "base16_decode", test_util_format_base16_decode, 0, NULL, NULL },
END_OF_TESTCASES