aboutsummaryrefslogtreecommitdiff
path: root/tests/core/cgo/add.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core/cgo/add.cpp')
-rw-r--r--tests/core/cgo/add.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/core/cgo/add.cpp b/tests/core/cgo/add.cpp
new file mode 100644
index 00000000..e5dbc0a9
--- /dev/null
+++ b/tests/core/cgo/add.cpp
@@ -0,0 +1,19 @@
+#include "add.h"
+#include <generated_cppopts.h>
+#include <generated_cxxopts.h>
+
+#if !defined(RULES_GO_CPP) || !defined(RULES_GO_CXX) || defined(RULES_GO_C)
+#error This is a C++ file, only RULES_GO_CXX and RULES_GO_CPP should be defined.
+#endif
+
+#if !defined(GENERATED_CPPOPTS) || !defined(GENERATED_CXXOPTS) || defined(GENERATED_COPTS)
+#error Generated headers should be correctly included
+#endif
+
+int add_cpp(int a, int b) {
+ int $ = 0;
+ int sum = a + b;
+ sum += DOLLAR_SIGN_CXX;
+ sum += DOLLAR_SIGN_CPP;
+ return sum;
+}