1 /*
2     Copyright (c) 2020 Intel Corporation
3 
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7 
8         http://www.apache.org/licenses/LICENSE-2.0
9 
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15 */
16 
17 #include "oneapi/tbb/task_group.h"
18 
19 #include "common/test.h"
20 #include "common/utils.h"
21 
22 //! \file conformance_task_group_context.cpp
23 //! \brief Test for [task_group_context] specification
24 
25 //! Test construction
26 //! \brief \ref interface
27 TEST_CASE("Test construction") {
28     {
29         oneapi::tbb::task_group_context ctx;
30         utils::suppress_unused_warning(ctx);
31     }
32     {
33         oneapi::tbb::task_group_context ctx{ oneapi::tbb::task_group_context::bound };
34         utils::suppress_unused_warning(ctx);
35     }
36     {
37         oneapi::tbb::task_group_context ctx{ oneapi::tbb::task_group_context::isolated
38             , oneapi::tbb::task_group_context::default_traits | oneapi::tbb::task_group_context::fp_settings | oneapi::tbb::task_group_context::concurrent_wait };
39         utils::suppress_unused_warning(ctx);
40     }
41 }
42 
43 //! Test methods
44 //! \brief \ref interface \ref requirement
45 TEST_CASE("Test methods") {
46     oneapi::tbb::task_group_context ctx{ oneapi::tbb::task_group_context::bound, oneapi::tbb::task_group_context::default_traits };
47     ctx.capture_fp_settings();
48     CHECK_FALSE(ctx.is_group_execution_cancelled());
49     CHECK(ctx.cancel_group_execution());
50     CHECK(ctx.is_group_execution_cancelled());
51     ctx.reset();
52     CHECK_FALSE(ctx.is_group_execution_cancelled());
53     ctx.traits();
54 }
55