diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/LLVMC/false.c | 14 | ||||
-rw-r--r-- | test/LLVMC/false.cpp | 17 | ||||
-rw-r--r-- | test/LLVMC/false2.cpp | 6 | ||||
-rw-r--r-- | test/LLVMC/hello.cpp | 8 |
4 files changed, 45 insertions, 0 deletions
diff --git a/test/LLVMC/false.c b/test/LLVMC/false.c new file mode 100644 index 0000000..80e9e03 --- /dev/null +++ b/test/LLVMC/false.c @@ -0,0 +1,14 @@ +// Test that we can compile .c files as C++ and vice versa +// RUN: llvmc2 -x c++ %s -x c %p/false.cpp -x lisp -x whatnot -x none %p/false2.cpp -o %t +// RUN: ./%t | grep hello + +#include <iostream> + +extern "C" void test(); +extern std::string test2(); + +int main() { + std::cout << "h"; + test(); + std::cout << test2() << '\n'; +} diff --git a/test/LLVMC/false.cpp b/test/LLVMC/false.cpp new file mode 100644 index 0000000..d3a7102 --- /dev/null +++ b/test/LLVMC/false.cpp @@ -0,0 +1,17 @@ +/* RUN: ignore */ +#include <stdio.h> + +/* Make this invalid C++ */ +typedef struct { + int i; + char c; +} a; + +static a b = { .i = 65, .c = 'r'}; + +void test() { + b.i = 9; + fflush(stdout); + printf("el"); +} + diff --git a/test/LLVMC/false2.cpp b/test/LLVMC/false2.cpp new file mode 100644 index 0000000..a020514 --- /dev/null +++ b/test/LLVMC/false2.cpp @@ -0,0 +1,6 @@ +// RUN: ignore +#include <string> + +std::string test2() { + return "lo"; +} diff --git a/test/LLVMC/hello.cpp b/test/LLVMC/hello.cpp new file mode 100644 index 0000000..a3148c3 --- /dev/null +++ b/test/LLVMC/hello.cpp @@ -0,0 +1,8 @@ +// Test that we can compile C++ code. +// RUN: llvmc2 %s -o %t +// RUN: ./%t | grep hello +#include <iostream> + +int main() { + std::cout << "hello" << '\n'; +} |