2019-11-19 14:31:44 +01:00
|
|
|
set test bin path:
|
|
|
|
|
|
|
|
$ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
|
|
|
|
|
|
|
|
check that base64 is producing expected results:
|
|
|
|
|
|
|
|
$ valgrind --quiet --leak-check=full test-b64
|
|
|
|
0
|
|
|
|
4 Zg==
|
|
|
|
4 Zm8=
|
|
|
|
4 Zm9v
|
|
|
|
8 Zm9vYg==
|
|
|
|
8 Zm9vYmE=
|
|
|
|
8 Zm9vYmFy
|
|
|
|
0
|
|
|
|
1 f
|
|
|
|
2 fo
|
|
|
|
3 foo
|
|
|
|
4 foob
|
|
|
|
5 fooba
|
|
|
|
6 foobar
|
2019-11-19 17:16:40 +01:00
|
|
|
|
2019-12-08 13:12:47 +01:00
|
|
|
$ test-b64-san
|
|
|
|
0
|
|
|
|
4 Zg==
|
|
|
|
4 Zm8=
|
|
|
|
4 Zm9v
|
|
|
|
8 Zm9vYg==
|
|
|
|
8 Zm9vYmE=
|
|
|
|
8 Zm9vYmFy
|
|
|
|
0
|
|
|
|
1 f
|
|
|
|
2 fo
|
|
|
|
3 foo
|
|
|
|
4 foob
|
|
|
|
5 fooba
|
|
|
|
6 foobar
|
|
|
|
|
2019-11-19 17:16:40 +01:00
|
|
|
check that b64_encode and b64_decode assert invalid input
|
|
|
|
|
2021-03-03 15:37:52 +01:00
|
|
|
$ alias check="grep Assertion output.log | sed 's;.*\(b64_.*code\).*\(Assertion.*$\);\1: \2;' | LC_ALL=C sort"
|
2019-12-08 13:12:47 +01:00
|
|
|
|
2021-03-03 15:37:52 +01:00
|
|
|
$ test-b64_decode > output.log 2>&1; check
|
2019-12-08 13:12:47 +01:00
|
|
|
b64_decode: Assertion `dest && targsize > 0' failed.
|
|
|
|
|
2021-03-03 15:37:52 +01:00
|
|
|
$ test-b64_encode > output.log 2>&1; check
|
2019-12-08 13:12:47 +01:00
|
|
|
b64_encode: Assertion `dest && targsize > 0' failed.
|
2019-11-19 17:16:40 +01:00
|
|
|
|
2021-03-03 13:49:27 +01:00
|
|
|
$ test-b64_decode-san > output.log 2>&1; check
|
2019-11-19 17:16:40 +01:00
|
|
|
b64_decode: Assertion `dest && targsize > 0' failed.
|
|
|
|
|
2021-03-03 13:49:27 +01:00
|
|
|
$ test-b64_encode-san > output.log 2>&1; check
|
2019-11-19 17:16:40 +01:00
|
|
|
b64_encode: Assertion `dest && targsize > 0' failed.
|