Back
//------------------------------------------------------------------------------------
// This file contains some test cases for syntax highlighting tools. The code is not
// intended to be syntactically correct. It won't compile.
//------------------------------------------------------------------------------------
// Test 1: Preprocessor directives
// 1a) Multiline preprocessor directive interupted by comments
// A preprocessor directive is extended to the next line if the line is ended by
// '\', even if the preproc directive was interupted by a comment.
#define TEST_MACRO(OneFunc)\
TFuncPtr ptr = NULL;\
if(func) /* comment interupts preproc directive ... */\
ptr = (TFuncPtr) func; /* ... however it is extended to the next line */\
\
return func; /* but this comments ends it ...\
... */int test1a;
// 1b) String with comment characters in preprocessor directive - will not be handled
// correctly, however most editors won't do so also :-)
#define SZ_HTML_PRGLINK "http://www.newty.de/lsc/index.html\"
// 1c) Single line comment in preprocessor
#include <string.h> // single line comment in preprocessor\
int test1c;
//------------------------------------------------------------------------------------
// Test 2: Comments
/* 2a) This is the single line comment one */int test2a;
/*
2b) This is the multiline comment two /* *
/
... which is continued until here //*/int test2b;
// 2c) This is comment three /*
int test2c;
//------------------------------------------------------------------------------------
// Test 3: Strings
char szBuffer[256];
// 3a) String with quotes, comment symbols and double escape character at its end
strcpy(szBuffer, "This string contains \"quotes\' and comment symbols: // /*.\\");
// 3b) String terminated by end of line - SYNTAX ERROR!
strcpy(szBuffer, "This unterminated string is ended by the end of the line.\");
int test3b;
// 3c) Multiline string
strcpy(szBuffer, "This is a multiline string\
which is continued until here");
//------------------------------------------------------------------------------------
// Test 4: Character chains
// 4a) Character chains with quotes, comment symbols and double escape character
// the end
char a='a', b='\0', c='This chain contains \'quotes\" and comment symbols: // /*.\\';
// 4b) Character chain terminated by end of line - SYNTAX ERROR!
char d='This unterminated character chain is ended by the end of the line;
int test4b;
//------------------------------------------------------------------------------
// Test 5: Numbers in some variations
int h1=0x34fe;
int h2=0x34FA;
int h3=0x34ff0L;
int h4=067777;
int h5=0.034;
int h6=12;
int h7=0L;
int h8=1.22e+3;
int h9=1.22e-3;
int h0=1.22E+3;
int hA=1.22E-3;
Top |