diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-01-04 13:25:26 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-03-17 15:37:11 +0100 |
commit | 18d3754647c4d5e29b48abdad8143b305681a0f9 (patch) | |
tree | 0f6e4000d6d36a438067d354c177aba727c5bbce /sources/shiboken6/tests/libminimal | |
parent | a922672c1c4f188cbab51b126b9cae4d7cd8706d (diff) |
shiboken6: Test non-fixed spans
Task-number: PYSIDE-2174
Change-Id: I91756983c187e56168a9afa5931785fc8e8bf27b
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/shiboken6/tests/libminimal')
-rw-r--r-- | sources/shiboken6/tests/libminimal/spanuser.cpp | 11 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/spanuser.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libminimal/spanuser.cpp b/sources/shiboken6/tests/libminimal/spanuser.cpp index 1fcfe1e97..e2e1ca1f5 100644 --- a/sources/shiboken6/tests/libminimal/spanuser.cpp +++ b/sources/shiboken6/tests/libminimal/spanuser.cpp @@ -23,6 +23,12 @@ IntSpan3 SpanUser::getIntSpan3() return IntSpan3(iv); } +IntSpan SpanUser::getIntSpan() +{ + static int iv[] = {1, 2, 3}; + return IntSpan(iv); +} + ConstIntSpan3 SpanUser::getConstIntSpan3() { static const int civ[] = {1, 2, 3}; @@ -34,6 +40,11 @@ int SpanUser::sumIntSpan3(IntSpan3 isp3) return std::accumulate(isp3.begin(), isp3.end(), 0); } +int SpanUser::sumIntSpan(IntSpan isp) +{ + return std::accumulate(isp.begin(), isp.end(), 0); +} + int SpanUser::sumConstIntSpan3(ConstIntSpan3 ispc3) { return std::accumulate(ispc3.begin(), ispc3.end(), 0); diff --git a/sources/shiboken6/tests/libminimal/spanuser.h b/sources/shiboken6/tests/libminimal/spanuser.h index ad6a0f2df..810aa9f84 100644 --- a/sources/shiboken6/tests/libminimal/spanuser.h +++ b/sources/shiboken6/tests/libminimal/spanuser.h @@ -10,6 +10,7 @@ # include <span> using IntSpan3 = std::span<int, 3>; +using IntSpan = std::span<int>; using ConstIntSpan3 = std::span<const int, 3>; #endif @@ -21,9 +22,11 @@ struct LIBMINIMAL_API SpanUser #if __cplusplus >= 202002L static IntSpan3 getIntSpan3(); + static IntSpan getIntSpan(); static ConstIntSpan3 getConstIntSpan3(); static int sumIntSpan3(IntSpan3 isp3); + static int sumIntSpan(IntSpan isp); static int sumConstIntSpan3(ConstIntSpan3 ispc3); #endif // C++ 20 }; |