151c0b2f7Stbbdev /*
2b15aabb3Stbbdev     Copyright (c) 2020-2021 Intel Corporation
351c0b2f7Stbbdev 
451c0b2f7Stbbdev     Licensed under the Apache License, Version 2.0 (the "License");
551c0b2f7Stbbdev     you may not use this file except in compliance with the License.
651c0b2f7Stbbdev     You may obtain a copy of the License at
751c0b2f7Stbbdev 
851c0b2f7Stbbdev         http://www.apache.org/licenses/LICENSE-2.0
951c0b2f7Stbbdev 
1051c0b2f7Stbbdev     Unless required by applicable law or agreed to in writing, software
1151c0b2f7Stbbdev     distributed under the License is distributed on an "AS IS" BASIS,
1251c0b2f7Stbbdev     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1351c0b2f7Stbbdev     See the License for the specific language governing permissions and
1451c0b2f7Stbbdev     limitations under the License.
1551c0b2f7Stbbdev */
1651c0b2f7Stbbdev 
1749e08aacStbbdev #include "oneapi/tbb/task_group.h"
1851c0b2f7Stbbdev 
1951c0b2f7Stbbdev #include "common/test.h"
2051c0b2f7Stbbdev #include "common/utils.h"
2151c0b2f7Stbbdev 
2251c0b2f7Stbbdev //! \file conformance_task_group_context.cpp
2351c0b2f7Stbbdev //! \brief Test for [task_group_context] specification
2451c0b2f7Stbbdev 
2551c0b2f7Stbbdev //! Test construction
2651c0b2f7Stbbdev //! \brief \ref interface
2751c0b2f7Stbbdev TEST_CASE("Test construction") {
2851c0b2f7Stbbdev     {
2949e08aacStbbdev         oneapi::tbb::task_group_context ctx;
3051c0b2f7Stbbdev         utils::suppress_unused_warning(ctx);
3151c0b2f7Stbbdev     }
3251c0b2f7Stbbdev     {
3349e08aacStbbdev         oneapi::tbb::task_group_context ctx{ oneapi::tbb::task_group_context::bound };
3451c0b2f7Stbbdev         utils::suppress_unused_warning(ctx);
3551c0b2f7Stbbdev     }
3651c0b2f7Stbbdev     {
3749e08aacStbbdev         oneapi::tbb::task_group_context ctx{ oneapi::tbb::task_group_context::isolated
3849e08aacStbbdev             , oneapi::tbb::task_group_context::default_traits | oneapi::tbb::task_group_context::fp_settings | oneapi::tbb::task_group_context::concurrent_wait };
3951c0b2f7Stbbdev         utils::suppress_unused_warning(ctx);
4051c0b2f7Stbbdev     }
4151c0b2f7Stbbdev }
4251c0b2f7Stbbdev 
4351c0b2f7Stbbdev //! Test methods
4451c0b2f7Stbbdev //! \brief \ref interface \ref requirement
4551c0b2f7Stbbdev TEST_CASE("Test methods") {
4649e08aacStbbdev     oneapi::tbb::task_group_context ctx{ oneapi::tbb::task_group_context::bound, oneapi::tbb::task_group_context::default_traits };
4751c0b2f7Stbbdev     ctx.capture_fp_settings();
4851c0b2f7Stbbdev     CHECK_FALSE(ctx.is_group_execution_cancelled());
4951c0b2f7Stbbdev     CHECK(ctx.cancel_group_execution());
5051c0b2f7Stbbdev     CHECK(ctx.is_group_execution_cancelled());
5151c0b2f7Stbbdev     ctx.reset();
5251c0b2f7Stbbdev     CHECK_FALSE(ctx.is_group_execution_cancelled());
5351c0b2f7Stbbdev     ctx.traits();
5451c0b2f7Stbbdev }
55*74b7fc74SAnton Potapov 
56*74b7fc74SAnton Potapov //TODO: add test for task_group_context(task_group_context*)
57