Skip to content

Commit

Permalink
Add test for multiple inclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenthuberdeau committed Aug 13, 2024
1 parent 8832d4b commit 6f9f247
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/_all/preprocessor/include/multiple-include.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// tests for #include "" directives

// putchar
#include <stdio.h>

#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"
#include "multiple-include.h"

void putint_aux(int n) {
if (n <= -10) putint_aux(n / 10);
putchar('0' - (n % 10));
}

void putint(int n) {
if (n < 0) {
putchar('-');
putint_aux(n);
} else {
putint_aux(-n);
}

putchar('\n');
}

void main() {
putint(CONSTANT1);
}
1 change: 1 addition & 0 deletions tests/_all/preprocessor/include/multiple-include.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
8 changes: 8 additions & 0 deletions tests/_all/preprocessor/include/multiple-include.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// tests for #include "" directives

#ifndef MULTI_INCLUDE
#define MULTI_INCLUDE

int CONSTANT1 = 1;

#endif

0 comments on commit 6f9f247

Please sign in to comment.