summaryrefslogtreecommitdiffstats
path: root/meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp')
-rw-r--r--meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp b/meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp
new file mode 100644
index 0000000000..83c9bfa844
--- /dev/null
+++ b/meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp
@@ -0,0 +1,25 @@
1/*
2* Copyright OpenEmbedded Contributors
3*
4* SPDX-License-Identifier: MIT
5*/
6
7#include "cpp-example-lib.hpp"
8
9#include <iostream>
10
11/* This is for creating a failing test for testing the test infrastructure */
12#ifndef FAIL_COMPARISON_STR
13#define FAIL_COMPARISON_STR ""
14#endif
15
16int main() {
17 auto cpp_example = CppExample();
18 auto ret_string = cpp_example.get_string();
19 if(0 == ret_string.compare(CppExample::test_string + FAIL_COMPARISON_STR)) {
20 std::cout << "PASS: " << ret_string << " = " << CppExample::test_string << std::endl;
21 } else {
22 std::cout << "FAIL: " << ret_string << " != " << CppExample::test_string << std::endl;
23 return 1;
24 }
25}