summaryrefslogtreecommitdiff
path: root/tests/src/Interop/WinRT/NativeComponent/Component.Contracts.ArrayTesting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/Interop/WinRT/NativeComponent/Component.Contracts.ArrayTesting.cpp')
-rw-r--r--tests/src/Interop/WinRT/NativeComponent/Component.Contracts.ArrayTesting.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/src/Interop/WinRT/NativeComponent/Component.Contracts.ArrayTesting.cpp b/tests/src/Interop/WinRT/NativeComponent/Component.Contracts.ArrayTesting.cpp
new file mode 100644
index 0000000000..3c5dafcc42
--- /dev/null
+++ b/tests/src/Interop/WinRT/NativeComponent/Component.Contracts.ArrayTesting.cpp
@@ -0,0 +1,19 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+#include "pch.h"
+#include "Component.Contracts.ArrayTesting.h"
+#include <numeric>
+
+namespace winrt::Component::Contracts::implementation
+{
+ int32_t ArrayTesting::Sum(array_view<int32_t const> array)
+ {
+ return std::accumulate(array.begin(), array.end(), 0);
+ }
+
+ bool ArrayTesting::Xor(array_view<bool const> array)
+ {
+ return std::accumulate(array.begin(), array.end(), false, [](bool left, bool right) { return left ^ right; });
+ }
+}