Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marcus Hoffmann
nettle
Commits
6ed22096
Commit
6ed22096
authored
Sep 30, 2002
by
Niels Möller
Browse files
(test_main): Test encoding and decoding
in place. Rev: src/nettle/testsuite/base64-test.c:1.2
parent
cff9e510
Changes
1
Hide whitespace changes
Inline
Side-by-side
testsuite/base64-test.c
View file @
6ed22096
...
...
@@ -11,7 +11,22 @@ test_main(void)
test_armor
(
&
nettle_base64
,
4
,
"Hell"
,
"SGVsbA=="
);
test_armor
(
&
nettle_base64
,
5
,
"Hello"
,
"SGVsbG8="
);
test_armor
(
&
nettle_base64
,
6
,
"Hello"
,
"SGVsbG8A"
);
test_armor
(
&
nettle_base64
,
4
,
"
\
377\377\377\377
"
,
"/////w=="
);
test_armor
(
&
nettle_base64
,
4
,
"
\
xff\xff\xff\xff
"
,
"/////w=="
);
{
/* Test overlapping areas */
uint8_t
buffer
[]
=
"Helloxxxx"
;
struct
base64_ctx
ctx
;
ASSERT
(
BASE64_ENCODE_LENGTH
(
5
)
==
8
);
ASSERT
(
8
==
base64_encode
(
buffer
,
5
,
buffer
));
ASSERT
(
MEMEQ
(
9
,
buffer
,
"SGVsbG8=x"
));
buffer
[
6
]
=
'='
;
base64_decode_init
(
&
ctx
);
ASSERT
(
4
==
base64_decode_update
(
&
ctx
,
buffer
,
8
,
buffer
));
ASSERT
(
MEMEQ
(
9
,
buffer
,
"HellbG==x"
));
}
SUCCESS
();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment