summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spcxx01/init.cc
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/sptests/spcxx01/init.cc')
-rw-r--r--testsuites/sptests/spcxx01/init.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/testsuites/sptests/spcxx01/init.cc b/testsuites/sptests/spcxx01/init.cc
index 7962810da0..b7be220092 100644
--- a/testsuites/sptests/spcxx01/init.cc
+++ b/testsuites/sptests/spcxx01/init.cc
@@ -29,6 +29,7 @@
#include "config.h"
#endif
+#include <future>
#include <new>
#include <rtems.h>
@@ -41,10 +42,8 @@ struct alignas(256) S {
int i;
};
-extern "C" void Init(rtems_task_argument arg)
+static void test_aligned_new(void)
{
- TEST_BEGIN();
-
int *i = static_cast<decltype(i)>(
::operator new(sizeof(*i), std::align_val_t(256))
);
@@ -58,6 +57,20 @@ extern "C" void Init(rtems_task_argument arg)
rtems_test_assert(s != nullptr);
rtems_test_assert(reinterpret_cast<uintptr_t>(s) % 256 == 0);
delete s;
+}
+
+static void test_future(void)
+{
+ std::future<int> f = std::async(std::launch::async, []{ return 12358; });
+ rtems_test_assert(f.get() == 12358);
+}
+
+extern "C" void Init(rtems_task_argument arg)
+{
+ TEST_BEGIN();
+
+ test_aligned_new();
+ test_future();
TEST_END();
exit(0);
@@ -69,6 +82,8 @@ extern "C" void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE