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 <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 and runtime interface versions
26 //! \brief \ref requirement \ref interface
27 TEST_CASE("Test interface version") {
28     REQUIRE_MESSAGE(TBB_runtime_interface_version()==TBB_INTERFACE_VERSION,
29         "Running with the library of different version than the test was compiled against.");
30 }
31 
32 //! Testing the match of compile-time and runtime version strings
33 //! \brief \ref requirement \ref interface
34 TEST_CASE("Test version string") {
35     REQUIRE_MESSAGE(std::strcmp( TBB_runtime_version(), TBB_VERSION_STRING )==0,
36         "Running with the library of different version than the test was compiled against.");
37 }
38 
39 //! Testing interface macros
40 //! \brief \ref requirement
41 TEST_CASE("Test interface version") {
42     REQUIRE(TBB_INTERFACE_VERSION / 1000 == TBB_INTERFACE_VERSION_MAJOR);
43     REQUIRE(TBB_INTERFACE_VERSION % 100 / 10 == TBB_INTERFACE_VERSION_MINOR);
44 }
45