Skip to content

Commit

Permalink
[tests] Add test dir for regression testing of generation of cxref db
Browse files Browse the repository at this point in the history
  • Loading branch information
thoni56 committed Jun 5, 2024
1 parent 0a7c446 commit e2f0045
Show file tree
Hide file tree
Showing 170 changed files with 38,258 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/generate_cxrefs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
include ../Makefile.boilerplate

COMMAND = ../../src/c-xref
ARGUMENTS = -xrefactory-II -create -errors -xrefrc .c-xrefrc -p $(CURDIR) -o output.tmp src

$(TEST): c_xrefrc_for_single_cxref_file
rm CXrefs
$(COMMAND) $(ARGUMENTS) | grep -v progress > output
cat CXrefs >> output
echo "<sync>" > expected
cat expected.cxrefs >> expected
$(VERIFY)

c_xrefrc_for_single_cxref_file: .c-xrefrc
ifeq ($(shell uname), Darwin)
sed -i '' 's/refnum=10/refnum=1/' .c-xrefrc
else
sed -i 's/refnum=10/refnum=1/' .c-xrefrc
endif
92 changes: 92 additions & 0 deletions tests/generate_cxrefs/src/ast.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#ifndef AST_INCLUDED
#define AST_INCLUDED

#include "symbol.h"
#include "id.h"
#include "proto.h" /* Because some AST nodes need types */


/* ************** parse tree with positions *********** */

// The following structures are used in the parsers, they always
// contain fields for begin and end position of parse tree
// node and additional 'data' for semantic actions.

typedef struct {
struct position begin, end;
int data;
} Ast_int;
typedef struct {
struct position begin, end;
unsigned data;
} Ast_unsigned;
typedef struct {
struct position begin, end;
struct symbol *data;
} Ast_symbol;
typedef struct {
struct position begin, end;
struct symbolList *data;
} Ast_symbolList;
typedef struct {
struct position begin, end;
struct typeModifier *data;
} Ast_typeModifiers;
typedef struct {
struct position begin, end;
struct typeModifierList *data;
} Ast_typeModifiersList;
typedef struct {
struct position begin, end;
struct stackFrame *data;
} Ast_frameAllocation;
typedef struct {
struct position begin, end;
Id *data;
} Ast_id;
typedef struct {
struct position begin, end;
struct idList *data;
} Ast_idList;
typedef struct {
struct position begin, end;
struct expressionTokenType data;
} Ast_expressionTokenType;
typedef struct {
struct position begin, end;
struct nestedConstrTokenType data;
} Ast_nestedConstrTokenType;
typedef struct {
struct position begin, end;
struct intPair data;
} Ast_intPair;
typedef struct {
struct position begin, end;
struct whileExtractData *data;
} Ast_whileExtractData;
typedef struct {
struct position begin, end;
struct position data;
} Ast_position;
typedef struct {
struct position begin, end;
struct unsignedPositionPair data;
} Ast_unsignedPositionPair;
typedef struct {
struct position begin, end;
struct symbolPositionPair data;
} Ast_symbolPositionPair;
typedef struct {
struct position begin, end;
struct symbolPositionListPair data;
} Ast_symbolPositionListPair;
typedef struct {
struct position begin, end;
struct positionList *data;
} Ast_positionList;
typedef struct {
struct position begin, end;
struct typeModifiersListPositionListPair data;
} Ast_typeModifiersListPositionListPair;

#endif
15 changes: 15 additions & 0 deletions tests/generate_cxrefs/src/c_parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
External declarations from c_parser-"module".
*/

#ifndef C_PARSER_H_INCLUDED
#define C_PARSER_H_INCLUDED

#include "proto.h"

extern int c_yyparse();
extern void makeCCompletions(char *s, int len, Position *pos);

#endif
Loading

0 comments on commit e2f0045

Please sign in to comment.