diff options
| author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-11-28 14:47:55 +0200 |
|---|---|---|
| committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-01-19 13:12:21 +0200 |
| commit | abca497b7223eed94ae4cbd65119ddfce7941027 (patch) | |
| tree | f9c7ff27533e4ee848746ddedcb11e4be0ea2e23 /test/src | |
| parent | 69b525494bf41097edc86d44b1d4b11ddfeb2440 (diff) | |
| download | redot-cpp-abca497b7223eed94ae4cbd65119ddfce7941027.tar.gz | |
Expose some low level functions and String operators.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/example.cpp | 24 | ||||
| -rw-r--r-- | test/src/example.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/src/example.cpp b/test/src/example.cpp index 6da1f52..dec8f57 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -123,6 +123,8 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("test_tarray"), &Example::test_tarray); ClassDB::bind_method(D_METHOD("test_dictionary"), &Example::test_dictionary); ClassDB::bind_method(D_METHOD("test_node_argument"), &Example::test_node_argument); + ClassDB::bind_method(D_METHOD("test_string_ops"), &Example::test_string_ops); + ClassDB::bind_method(D_METHOD("test_vector_ops"), &Example::test_vector_ops); ClassDB::bind_method(D_METHOD("def_args", "a", "b"), &Example::def_args, DEFVAL(100), DEFVAL(200)); @@ -255,6 +257,28 @@ Array Example::test_array() const { return arr; } +String Example::test_string_ops() const { + String s = String("A"); + s += "B"; + s += "C"; + s += char32_t(0x010E); + s = s + "E"; + return s; +} + +int Example::test_vector_ops() const { + PackedInt32Array arr; + arr.push_back(10); + arr.push_back(20); + arr.push_back(30); + arr.push_back(45); + int ret = 0; + for (const int32_t &E : arr) { + ret += E; + } + return ret; +} + void Example::test_tarray_arg(const TypedArray<int64_t> &p_array) { for (int i = 0; i < p_array.size(); i++) { UtilityFunctions::print(p_array[i]); diff --git a/test/src/example.h b/test/src/example.h index 6857be2..2d4a6b0 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -101,6 +101,8 @@ public: TypedArray<Vector2> test_tarray() const; Dictionary test_dictionary() const; Example *test_node_argument(Example *p_node) const; + String test_string_ops() const; + int test_vector_ops() const; // Property. void set_custom_position(const Vector2 &pos); |
