1acc60b03SMartin Matuska /*-
2*bd66c1b4SMartin Matuska * SPDX-License-Identifier: BSD-2-Clause
3*bd66c1b4SMartin Matuska *
4acc60b03SMartin Matuska * Copyright (c) 2003-2007 Tim Kientzle
5acc60b03SMartin Matuska * Copyright (c) 2012 Michihiro NAKAJIMA
6acc60b03SMartin Matuska * All rights reserved.
7acc60b03SMartin Matuska */
8acc60b03SMartin Matuska #include "test.h"
9acc60b03SMartin Matuska
DEFINE_TEST(test_option_b64encode)10acc60b03SMartin Matuska DEFINE_TEST(test_option_b64encode)
11acc60b03SMartin Matuska {
12acc60b03SMartin Matuska char *p;
13acc60b03SMartin Matuska size_t s;
14acc60b03SMartin Matuska
15acc60b03SMartin Matuska /* Create a file. */
16acc60b03SMartin Matuska assertMakeFile("f", 0644, "a");
17acc60b03SMartin Matuska
18acc60b03SMartin Matuska /* Archive it with compress compression and uuencode. */
19acc60b03SMartin Matuska assertEqualInt(0,
20acc60b03SMartin Matuska systemf("%s -cf - -Z --b64encode f >archive.out 2>archive.err",
21acc60b03SMartin Matuska testprog));
22acc60b03SMartin Matuska /* Check that the archive file has an uuencode signature. */
23acc60b03SMartin Matuska p = slurpfile(&s, "archive.out");
24acc60b03SMartin Matuska assert(s > 2);
25acc60b03SMartin Matuska assertEqualMem(p, "begin-base64 644", 16);
2663ecfce8SEnji Cooper free(p);
27acc60b03SMartin Matuska
28acc60b03SMartin Matuska /* Archive it with uuencode only. */
29acc60b03SMartin Matuska assertEqualInt(0,
30acc60b03SMartin Matuska systemf("%s -cf - --b64encode f >archive.out 2>archive.err",
31acc60b03SMartin Matuska testprog));
32acc60b03SMartin Matuska /* Check that the archive file has an uuencode signature. */
33acc60b03SMartin Matuska p = slurpfile(&s, "archive.out");
34acc60b03SMartin Matuska assert(s > 2);
35acc60b03SMartin Matuska assertEqualMem(p, "begin-base64 644", 16);
3663ecfce8SEnji Cooper free(p);
37acc60b03SMartin Matuska }
38