"Fossies" - the Fresh Open Source Software Archive

Member "libextractor-1.11/src/plugins/test_deb.c" (30 Jan 2021, 5396 Bytes) of package /linux/privat/libextractor-1.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2      This file is part of libextractor.
    3      Copyright (C) 2012 Vidyut Samanta and Christian Grothoff
    4 
    5      libextractor is free software; you can redistribute it and/or modify
    6      it under the terms of the GNU General Public License as published
    7      by the Free Software Foundation; either version 3, or (at your
    8      option) any later version.
    9 
   10      libextractor is distributed in the hope that it will be useful, but
   11      WITHOUT ANY WARRANTY; without even the implied warranty of
   12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13      General Public License for more details.
   14 
   15      You should have received a copy of the GNU General Public License
   16      along with libextractor; see the file COPYING.  If not, write to the
   17      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   18      Boston, MA 02110-1301, USA.
   19 */
   20 /**
   21  * @file plugins/test_deb.c
   22  * @brief testcase for deb plugin
   23  * @author Christian Grothoff
   24  */
   25 #include "platform.h"
   26 #include "test_lib.h"
   27 
   28 
   29 /**
   30  * Main function for the DEB testcase.
   31  *
   32  * @param argc number of arguments (ignored)
   33  * @param argv arguments (ignored)
   34  * @return 0 on success
   35  */
   36 int
   37 main (int argc, char *argv[])
   38 {
   39   struct SolutionData deb_bzip2_sol[] = {
   40     {
   41       EXTRACTOR_METATYPE_MIMETYPE,
   42       EXTRACTOR_METAFORMAT_UTF8,
   43       "text/plain",
   44       "application/x-debian-package",
   45       strlen ("application/x-debian-package") + 1,
   46       0
   47     },
   48     {
   49       EXTRACTOR_METATYPE_PACKAGE_NAME,
   50       EXTRACTOR_METAFORMAT_UTF8,
   51       "text/plain",
   52       "bzip2",
   53       strlen ("bzip2") + 1,
   54       0
   55     },
   56     {
   57       EXTRACTOR_METATYPE_PACKAGE_VERSION,
   58       EXTRACTOR_METAFORMAT_UTF8,
   59       "text/plain",
   60       "1.0.6-4",
   61       strlen ("1.0.6-4") + 1,
   62       0
   63     },
   64     {
   65       EXTRACTOR_METATYPE_TARGET_ARCHITECTURE,
   66       EXTRACTOR_METAFORMAT_UTF8,
   67       "text/plain",
   68       "i386",
   69       strlen ("i386") + 1,
   70       0
   71     },
   72     {
   73       EXTRACTOR_METATYPE_PACKAGE_MAINTAINER,
   74       EXTRACTOR_METAFORMAT_UTF8,
   75       "text/plain",
   76       "Anibal Monsalve Salazar <anibal@debian.org>",
   77       strlen ("Anibal Monsalve Salazar <anibal@debian.org>") + 1,
   78       0
   79     },
   80     {
   81       EXTRACTOR_METATYPE_PACKAGE_INSTALLED_SIZE,
   82       EXTRACTOR_METAFORMAT_UTF8,
   83       "text/plain",
   84       "113", /* FIXME: should this be 'kb'? */
   85       strlen ("113") + 1,
   86       0
   87     },
   88     {
   89       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
   90       EXTRACTOR_METAFORMAT_UTF8,
   91       "text/plain",
   92       "libbz2-1.0 (= 1.0.6-4), libc6 (>= 2.4)",
   93       strlen ("libbz2-1.0 (= 1.0.6-4), libc6 (>= 2.4)") + 1,
   94       0
   95     },
   96     {
   97       EXTRACTOR_METATYPE_PACKAGE_SUGGESTS,
   98       EXTRACTOR_METAFORMAT_UTF8,
   99       "text/plain",
  100       "bzip2-doc",
  101       strlen ("bzip2-doc") + 1,
  102       0
  103     },
  104     {
  105       EXTRACTOR_METATYPE_PACKAGE_REPLACES,
  106       EXTRACTOR_METAFORMAT_UTF8,
  107       "text/plain",
  108       "libbz2 (<< 0.9.5d-3)",
  109       strlen ("libbz2 (<< 0.9.5d-3)") + 1,
  110       0
  111     },
  112     {
  113       EXTRACTOR_METATYPE_SECTION,
  114       EXTRACTOR_METAFORMAT_UTF8,
  115       "text/plain",
  116       "utils",
  117       strlen ("utils") + 1,
  118       0
  119     },
  120     {
  121       EXTRACTOR_METATYPE_UPLOAD_PRIORITY,
  122       EXTRACTOR_METAFORMAT_UTF8,
  123       "text/plain",
  124       "standard",
  125       strlen ("standard") + 1,
  126       0
  127     },
  128     {
  129       EXTRACTOR_METATYPE_DESCRIPTION,
  130       EXTRACTOR_METAFORMAT_UTF8,
  131       "text/plain",
  132       "high-quality block-sorting file compressor - utilities\n"
  133       " bzip2 is a freely available, patent free, high-quality data compressor.\n"
  134       " It typically compresses files to within 10% to 15% of the best available\n"
  135       " techniques, whilst being around twice as fast at compression and six\n"
  136       " times faster at decompression.\n"
  137       " .\n"
  138       " bzip2 compresses files using the Burrows-Wheeler block-sorting text\n"
  139       " compression algorithm, and Huffman coding.  Compression is generally\n"
  140       " considerably better than that achieved by more conventional\n"
  141       " LZ77/LZ78-based compressors, and approaches the performance of the PPM\n"
  142       " family of statistical compressors.\n"
  143       " .\n"
  144       " The archive file format of bzip2 (.bz2) is incompatible with that of its\n"
  145       " predecessor, bzip (.bz).",
  146       strlen ("high-quality block-sorting file compressor - utilities\n"
  147               " bzip2 is a freely available, patent free, high-quality data compressor.\n"
  148               " It typically compresses files to within 10% to 15% of the best available\n"
  149               " techniques, whilst being around twice as fast at compression and six\n"
  150               " times faster at decompression.\n"
  151               " .\n"
  152               " bzip2 compresses files using the Burrows-Wheeler block-sorting text\n"
  153               " compression algorithm, and Huffman coding.  Compression is generally\n"
  154               " considerably better than that achieved by more conventional\n"
  155               " LZ77/LZ78-based compressors, and approaches the performance of the PPM\n"
  156               " family of statistical compressors.\n"
  157               " .\n"
  158               " The archive file format of bzip2 (.bz2) is incompatible with that of its\n"
  159               " predecessor, bzip (.bz).") + 1,
  160       0
  161     },
  162     { 0, 0, NULL, NULL, 0, -1 }
  163   };
  164   struct ProblemSet ps[] = {
  165     { "testdata/deb_bzip2.deb",
  166       deb_bzip2_sol },
  167     { NULL, NULL }
  168   };
  169   return ET_main ("deb", ps);
  170 }
  171 
  172 
  173 /* end of test_deb.c */