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 "common/test.h"
18 
19 #include "oneapi/tbb/version.h"
20 #include <cstring>
21 
22 //! \file conformance_version.cpp
23 //! \brief Test for [version_information] specification
24 
25 //! Testing the match of compile-time oneTBB specification version
26 //! \brief \ref requirement \ref interface
27 TEST_CASE("Test specification version") {
28     const char* expected = "1.0";
29     REQUIRE_MESSAGE(std::strcmp(expected, ONETBB_SPEC_VERSION) == 0,
30         "Expected and actual specification versions do not match.");
31 }
32 
33 //! Testing the match of compile-time and runtime interface versions
34 //! \brief \ref requirement \ref interface
35 TEST_CASE("Test interface version") {
36     REQUIRE_MESSAGE(TBB_runtime_interface_version()==TBB_INTERFACE_VERSION,
37         "Running with the library of different version than the test was compiled against.");
38 }
39 
40 //! Testing the match of compile-time and runtime version strings
41 //! \brief \ref requirement \ref interface
42 TEST_CASE("Test version string") {
43     REQUIRE_MESSAGE(std::strcmp( TBB_runtime_version(), TBB_VERSION_STRING )==0,
44         "Running with the library of different version than the test was compiled against.");
45 }
46 
47 //! Testing interface macros
48 //! \brief \ref requirement
49 TEST_CASE("Test interface version") {
50     REQUIRE(TBB_INTERFACE_VERSION / 1000 == TBB_INTERFACE_VERSION_MAJOR);
51     REQUIRE(TBB_INTERFACE_VERSION % 100 / 10 == TBB_INTERFACE_VERSION_MINOR);
52 }
53