#comment #####################################################################
#comment Filepp testsuite.  This is run with the command: filepp testsuite
#comment It should produce no output other than a final OK.
#comment Thanks to Stephen Brooks for providing the original version of this.
#comment #####################################################################
#comment #####################################################################
#comment Numerical defines, ifs and ifdefs
#comment #####################################################################
#define FRED 1
#if FRED == 1
#else
FAIL __LINE__
#endif
#if FRED == 2
FAIL __LINE__
#else
#endif
#define GEORGE 1
#if defined GEORGE
#else
FAIL __LINE__
#endif
#if ! defined GEORGE
FAIL __LINE__
#else
#endif
#define BILL 
#if defined BILL
#else
FAIL __LINE__
#endif
#if ! defined BILL
FAIL __LINE__
#else
#endif
#if defined GINGER
FAIL __LINE__
#else
#endif
#if ! defined GINGER
#else
FAIL __LINE__
#endif
#if GEORGE == BILL
FAIL __LINE__
#endif
#if GEORGE != BILL
FAIL __LINE__
#else
#endif
#define HERBERT 34
#define JOHN 34
#if (GEORGE == BILL) && (JOHN == HERBERT)
FAIL __LINE__
#endif
#if (GEORGE != BILL) && (JOHN == HERBERT)
FAIL __LINE__
#else
#endif
#if (GEORGE == BILL) && (JOHN != HERBERT)
FAIL __LINE__
#else
#endif
#if (GEORGE > BILL) && (JOHN != HERBERT)
FAIL __LINE__
#else
#endif
#if (JOHN < BILL) 
FAIL __LINE__
#else
#endif
#if (JOHN < 33) 
FAIL __LINE__
#else
#endif
#if (JOHN > 33) 
#else
FAIL __LINE__
#endif
#ifdef BILL
#else
FAIL __LINE__
#endif
#undef BILL
#ifdef BILL
FAIL __LINE__
#endif
#ifdef PAUL
FAIL __LINE__
#else
#endif
#define ZERO 0
#if("ZERO" ne "0")
FAIL __LINE__
#endif
#comment This next test is to check recursion is avoided, this used to throw
#comment filepp into a recursive loop
#define RECURS1 RECURS2 RECURS2
#define RECURS2 RECURS1 RECURS1
#if "RECURS1" eq "RECURS2"
#endif
#comment #####################################################################
#comment Macros with arguments and perl string comparisons
#comment #####################################################################
#define ARTHUR(bill, ben) bill and ben
#if (defined ARTHUR)
#else
FAIL __LINE__
#endif
#if !defined (ARTHUR)
FAIL __LINE__
#else
#ifdef ARTHUR
#else
FAIL __LINE__
#endif
#ifndef ARTHUR
FAIL __LINE__
#else
#endif
#endif
#if "ARTHUR" eq "ARTHUR"
#else
FAIL __LINE__
#endif
#if("ARTHUR" eq "ARTHUR")
#else
FAIL __LINE__
#endif
#if "ARTHUR(bill,ben)" ne "bill and ben"
FAIL __LINE__
#endif
#warning testsuite should now show warning about macro 'ARTHUR':
#if "ARTHUR(bill)" ne "bill and "
FAIL __LINE__
#endif
#warning testsuite should now show warning about macro 'ARTHUR':
#if "ARTHUR(ben)" eq "bill and ben"
FAIL __LINE__
#endif
#warning testsuite should now show warning about macro 'ARTHUR':
#if "ARTHUR(bill ben)" eq "bill and ben"
FAIL __LINE__
#endif
#if "ARTHUR(fred, ben)" eq "bill and ben"
FAIL __LINE__
#endif
#define DEREK(VAL1, VAL2) :VAL1:VAL2:
#if "DEREK(func(arg1,arg2),scalar)" ne ":func(arg1,arg2):scalar:"
FAIL __LINE__
#endif
#define MANYARGS(ONE, TWO, THREE, FOUR) ONE and TWO TWO and THREE and FOUR
#if "MANYARGS(1,2,3,4())" ne "1 and 2 2 and 3 and 4()"
FAIL __LINE__
#endif
#if "MANYARGS (spaces,	tabs	tabs,  , and gaps)" ne \
"spaces and tabs	tabs tabs	tabs and  and and gaps"
FAIL __LINE__
#endif
#define NOARGS (ONE, TWO) ONE TWO
#if "NOARGS" ne "(ONE, TWO) ONE TWO"
FAIL __LINE__
#endif
#define RECURSION(AGAIN) AGAIN
#if "RECURSION(RECURSION(RECURSION(OK)))" ne "OK"
FAIL __LINE__
#endif
#comment #####################################################################
#comment Nested ifs
#comment #####################################################################
#if 1
#if 0
FAIL __LINE__
#else
#endif
#else
FAIL __LINE__
#endif
#comment #####################################################################
#if 0
FAIL __LINE__
#if 1
FAIL __LINE__
#else
FAIL __LINE__
#endif
FAIL __LINE__
#else
#endif
#comment #####################################################################
#ifndef ARTHUR
FAIL __LINE__
#ifndef PHIL
FAIL __LINE__
#else
FAIL __LINE__
#endif
FAIL __LINE__
#else
#endif
#comment #####################################################################
#ifndef PHIL
#ifndef ARTHUR
FAIL __LINE__
#else
#endif
#else
FAIL __LINE__
#endif
#comment #####################################################################
#ifndef ARTHUR
FAIL __LINE__
#ifndef PHIL
FAIL __LINE__
#else
FAIL __LINE__
#endif
#else
#endif
#comment #####################################################################
#comment elsif
#comment #####################################################################
#if 1
  #if 0
FAIL __LINE__
  #elif 1
    #if 0
FAIL __LINE__
    #else
    #elif 1
FAIL __LINE__
    #endif
  #else
FAIL __LINE__
  #endif
#elif 1
FAIL __LINE__
#elif 1
FAIL __LINE__
#endif
#comment #####################################################################
#comment Includes
#comment #####################################################################
#include "testinc"
#ifndef INCLUDED
FAIL __LINE__
#endif
#comment #####################################################################
#comment Non-ascii
#comment #####################################################################
#comment define  POUND
#comment   
#comment #####################################################################
#comment White space
#comment #####################################################################
#   if  1
    #     else
FAIL __LINE__
                                                                     \
         # endif
#ifndef                                                             \
           GEORGE
FAIL __LINE__
#endif
#comment #####################################################################
#comment Pragma, Modules and keywords
#comment #####################################################################
#pragma filepp UseModule testmod.pm
#TEST comment This should be parsed as a TEST\
              normal comment
#TEST if TEST\
 0
FAIL __LINE__
#TEST endif
#TEST pragma filepp SetKeywordchar \#
#pragma filepp SetContchar \\
#comment Normal line \
         continution 
#if \
 0
FAIL __LINE__
#endif
#comment #####################################################################
#comment Safemode
#comment #####################################################################
#pragma filepp SafeMode
#pragma filepp SetKeywordchar UNSAFE
#comment FAIL __LINE__
#comment #####################################################################
#comment End of tests
#comment #####################################################################
