libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

test_ps.c (3725B)


      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_ps.c
     22  * @brief testcase for ps plugin
     23  * @author Christian Grothoff
     24  */
     25 #include "platform.h"
     26 #include "test_lib.h"
     27 
     28 
     29 /**
     30  * Main function for the PS 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 ps_bloomfilter_sol[] = {
     40     {
     41       EXTRACTOR_METATYPE_MIMETYPE,
     42       EXTRACTOR_METAFORMAT_UTF8,
     43       "text/plain",
     44       "application/postscript",
     45       strlen ("application/postscript") + 1,
     46       0
     47     },
     48     {
     49       EXTRACTOR_METATYPE_TITLE,
     50       EXTRACTOR_METAFORMAT_UTF8,
     51       "text/plain",
     52       "A Quick Introduction to Bloom Filters",
     53       strlen ("A Quick Introduction to Bloom Filters") + 1,
     54       0
     55     },
     56     {
     57       EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE,
     58       EXTRACTOR_METAFORMAT_UTF8,
     59       "text/plain",
     60       "dvips(k) 5.92b Copyright 2002 Radical Eye Software",
     61       strlen ("dvips(k) 5.92b Copyright 2002 Radical Eye Software") + 1,
     62       0
     63     },
     64     {
     65       EXTRACTOR_METATYPE_PAGE_COUNT,
     66       EXTRACTOR_METAFORMAT_UTF8,
     67       "text/plain",
     68       "1",
     69       strlen ("1") + 1,
     70       0
     71     },
     72     {
     73       EXTRACTOR_METATYPE_PAGE_ORDER,
     74       EXTRACTOR_METAFORMAT_UTF8,
     75       "text/plain",
     76       "Ascend",
     77       strlen ("Ascend") + 1,
     78       0
     79     },
     80     { 0, 0, NULL, NULL, 0, -1 }
     81   };
     82   struct SolutionData ps_wallace_sol[] = {
     83     {
     84       EXTRACTOR_METATYPE_MIMETYPE,
     85       EXTRACTOR_METAFORMAT_UTF8,
     86       "text/plain",
     87       "application/postscript",
     88       strlen ("application/postscript") + 1,
     89       0
     90     },
     91     {
     92       EXTRACTOR_METATYPE_SUBJECT,
     93       EXTRACTOR_METAFORMAT_UTF8,
     94       "text/plain",
     95       "PS preprint of JPEG article submitted to IEEE Trans on Consum. Elect",
     96       strlen (
     97         "PS preprint of JPEG article submitted to IEEE Trans on Consum. Elect")
     98       + 1,
     99       0
    100     },
    101     {
    102       EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE,
    103       EXTRACTOR_METAFORMAT_UTF8,
    104       "text/plain",
    105       "DECwrite V1.1 Copyright (c) 1990 DIGITAL EQUIPMENT CORPORATION.   All Rights Reserved.",
    106       strlen (
    107         "DECwrite V1.1 Copyright (c) 1990 DIGITAL EQUIPMENT CORPORATION.   All Rights Reserved.")
    108       + 1,
    109       0
    110     },
    111     {
    112       EXTRACTOR_METATYPE_AUTHOR_NAME,
    113       EXTRACTOR_METAFORMAT_UTF8,
    114       "text/plain",
    115       "Greg Wallace",
    116       strlen ("Greg Wallace") + 1,
    117       0
    118     },
    119     {
    120       EXTRACTOR_METATYPE_UNKNOWN_DATE,
    121       EXTRACTOR_METAFORMAT_UTF8,
    122       "text/plain",
    123       "Tue, 17 Dec 91 14:49:50 PST",
    124       strlen ("Tue, 17 Dec 91 14:49:50 PST") + 1,
    125       0
    126     },
    127     { 0, 0, NULL, NULL, 0, -1 }
    128   };
    129   struct ProblemSet ps[] = {
    130     { "testdata/ps_bloomfilter.ps",
    131       ps_bloomfilter_sol },
    132     { "testdata/ps_wallace.ps",
    133       ps_wallace_sol },
    134     { NULL, NULL }
    135   };
    136   return ET_main ("ps", ps);
    137 }
    138 
    139 
    140 /* end of test_ps.c */