151c0b2f7Stbbdev /* 2*e1f0f360SDmitri Mokhov Copyright (c) 2020-2023 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 1751c0b2f7Stbbdev #include "common/test.h" 1851c0b2f7Stbbdev 1949e08aacStbbdev #include "oneapi/tbb/version.h" 2051c0b2f7Stbbdev #include <cstring> 2151c0b2f7Stbbdev 2251c0b2f7Stbbdev //! \file conformance_version.cpp 2351c0b2f7Stbbdev //! \brief Test for [version_information] specification 2451c0b2f7Stbbdev 2549e08aacStbbdev //! Testing the match of compile-time oneTBB specification version 2649e08aacStbbdev //! \brief \ref requirement \ref interface 2749e08aacStbbdev TEST_CASE("Test specification version") { 2849e08aacStbbdev const char* expected = "1.0"; 2949e08aacStbbdev REQUIRE_MESSAGE(std::strcmp(expected, ONETBB_SPEC_VERSION) == 0, 3049e08aacStbbdev "Expected and actual specification versions do not match."); 3149e08aacStbbdev } 3249e08aacStbbdev 3351c0b2f7Stbbdev //! Testing the match of compile-time and runtime interface versions 3451c0b2f7Stbbdev //! \brief \ref requirement \ref interface 3551c0b2f7Stbbdev TEST_CASE("Test interface version") { 3651c0b2f7Stbbdev REQUIRE_MESSAGE(TBB_runtime_interface_version()==TBB_INTERFACE_VERSION, 3751c0b2f7Stbbdev "Running with the library of different version than the test was compiled against."); 3851c0b2f7Stbbdev } 3951c0b2f7Stbbdev 4051c0b2f7Stbbdev //! Testing the match of compile-time and runtime version strings 4151c0b2f7Stbbdev //! \brief \ref requirement \ref interface 4251c0b2f7Stbbdev TEST_CASE("Test version string") { 4351c0b2f7Stbbdev REQUIRE_MESSAGE(std::strcmp( TBB_runtime_version(), TBB_VERSION_STRING )==0, 4451c0b2f7Stbbdev "Running with the library of different version than the test was compiled against."); 4551c0b2f7Stbbdev } 4651c0b2f7Stbbdev 4751c0b2f7Stbbdev //! Testing interface macros 4851c0b2f7Stbbdev //! \brief \ref requirement 4951c0b2f7Stbbdev TEST_CASE("Test interface version") { 5051c0b2f7Stbbdev REQUIRE(TBB_INTERFACE_VERSION / 1000 == TBB_INTERFACE_VERSION_MAJOR); 51*e1f0f360SDmitri Mokhov REQUIRE(TBB_INTERFACE_VERSION % 1000 / 10 == TBB_INTERFACE_VERSION_MINOR); 5251c0b2f7Stbbdev } 53