diff options
| author | ruki <[email protected]> | 2019-09-06 22:51:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-09-06 11:11:25 +0800 |
| commit | 7210427c931d41fd52608ee5a502ea54414d6606 (patch) | |
| tree | ade539fdb971d8974efcc14e20819fe187601c63 /tests/projects/c++/modules/class/src | |
| parent | 5c0286dd6ec8c3f8bf7e6c4e7cecd9d5903948e8 (diff) | |
add some c++ module tests
Diffstat (limited to 'tests/projects/c++/modules/class/src')
| -rw-r--r-- | tests/projects/c++/modules/class/src/hello.mpp | 12 | ||||
| -rw-r--r-- | tests/projects/c++/modules/class/src/hello_impl.cpp | 16 | ||||
| -rw-r--r-- | tests/projects/c++/modules/class/src/main.cpp | 7 |
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/class/src/hello.mpp b/tests/projects/c++/modules/class/src/hello.mpp new file mode 100644 index 000000000..9e4ecd960 --- /dev/null +++ b/tests/projects/c++/modules/class/src/hello.mpp @@ -0,0 +1,12 @@ +export module hello; + +export namespace hello { + class say { + public: + say(int data); + void hello(); + + private: + int data_; + }; +}
\ No newline at end of file diff --git a/tests/projects/c++/modules/class/src/hello_impl.cpp b/tests/projects/c++/modules/class/src/hello_impl.cpp new file mode 100644 index 000000000..b929c453b --- /dev/null +++ b/tests/projects/c++/modules/class/src/hello_impl.cpp @@ -0,0 +1,16 @@ +// module; +#include <iostream> +module hello; + +// import std.core; +using namespace std; + +namespace hello { + say::say(int data) : data_(data) { + + } + + void say::hello() { + cout << "hello, say class: " << data_ << endl; + } +} diff --git a/tests/projects/c++/modules/class/src/main.cpp b/tests/projects/c++/modules/class/src/main.cpp new file mode 100644 index 000000000..6f80b6c7d --- /dev/null +++ b/tests/projects/c++/modules/class/src/main.cpp @@ -0,0 +1,7 @@ +import hello; + +int main() { + hello::say s(sizeof(hello::say)); + s.hello(); + return 0; +}
\ No newline at end of file |
