|
Packit |
f00812 |
/*
|
|
Packit |
f00812 |
* This file is part of flex.
|
|
Packit |
f00812 |
*
|
|
Packit |
f00812 |
* Redistribution and use in source and binary forms, with or without
|
|
Packit |
f00812 |
* modification, are permitted provided that the following conditions
|
|
Packit |
f00812 |
* are met:
|
|
Packit |
f00812 |
*
|
|
Packit |
f00812 |
* 1. Redistributions of source code must retain the above copyright
|
|
Packit |
f00812 |
* notice, this list of conditions and the following disclaimer.
|
|
Packit |
f00812 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
Packit |
f00812 |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit |
f00812 |
* documentation and/or other materials provided with the distribution.
|
|
Packit |
f00812 |
*
|
|
Packit |
f00812 |
* Neither the name of the University nor the names of its contributors
|
|
Packit |
f00812 |
* may be used to endorse or promote products derived from this software
|
|
Packit |
f00812 |
* without specific prior written permission.
|
|
Packit |
f00812 |
*
|
|
Packit |
f00812 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
Packit |
f00812 |
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
Packit |
f00812 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
Packit |
f00812 |
* PURPOSE.
|
|
Packit |
f00812 |
*/
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
#include <assert.h>
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
#include "top.h"
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
/* The scanner itself is not important here.
|
|
Packit |
f00812 |
* We simply try to use all the functions that are exported in the
|
|
Packit |
f00812 |
* header, to see if we get any compiler warnings.
|
|
Packit |
f00812 |
*/
|
|
Packit |
f00812 |
int
|
|
Packit |
f00812 |
main ( int argc, char** argv )
|
|
Packit |
f00812 |
{
|
|
Packit |
f00812 |
(void)argc;
|
|
Packit |
f00812 |
(void)argv;
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
yyscan_t scanner;
|
|
Packit |
f00812 |
FILE *fp;
|
|
Packit |
f00812 |
char * extra = "EXTRA";
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
testlex_init(&scanner);
|
|
Packit |
f00812 |
testset_in(stdin,scanner);
|
|
Packit |
f00812 |
testset_out(stdout,scanner);
|
|
Packit |
f00812 |
testset_extra(extra,scanner);
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
fp = testget_in(scanner);
|
|
Packit |
f00812 |
assert(fp == stdin);
|
|
Packit |
f00812 |
fp = testget_out(scanner);
|
|
Packit |
f00812 |
assert(fp == stdout);
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
while(testlex(scanner)) {
|
|
Packit |
f00812 |
char * text;
|
|
Packit |
f00812 |
int line;
|
|
Packit |
f00812 |
line = testget_lineno(scanner);
|
|
Packit |
f00812 |
text = testget_text(scanner);
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
if( (char*)testget_extra(scanner) != extra)
|
|
Packit |
f00812 |
break;
|
|
Packit |
f00812 |
|
|
Packit |
f00812 |
if ( !text || line < 0)
|
|
Packit |
f00812 |
continue;
|
|
Packit |
f00812 |
}
|
|
Packit |
f00812 |
testlex_destroy(scanner);
|
|
Packit |
f00812 |
printf("TEST RETURNING OK.\n");
|
|
Packit |
f00812 |
return 0;
|
|
Packit |
f00812 |
}
|