Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
unit-tests
internal
internal-tests-class-logic.cpp
Go to the documentation of this file.
1
// License: Apache 2.0. See LICENSE file in root directory.
2
// Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3
4
#include "
catch.h
"
5
#include <cmath>
6
#include <iostream>
7
#include "./../src/api.h"
8
9
TEST_CASE
(
"verify_version_compatibility"
,
"[code]"
)
10
{
11
rs2_error
*
e
= 0;
12
rs2_context
*
ctx
=
nullptr
;
13
14
auto
runtime_api_version =
rs2_get_api_version
(&e);
15
CAPTURE
(runtime_api_version);
16
REQUIRE
(!e);
17
18
int
api_ver =
RS2_API_VERSION
;
19
int
major
= (api_ver / 10000);
20
int
minor
= (api_ver / 100) % 100;
21
int
patch
= api_ver % 100;
22
23
REQUIRE_NOTHROW
(
verify_version_compatibility
(api_ver));
25
REQUIRE_THROWS
(
verify_version_compatibility
(api_ver + 10000));
26
REQUIRE_THROWS
(
verify_version_compatibility
(api_ver - 10000));
27
28
// Differences in minor are compatible as long as exe_ver <= lib_ver
29
if
(minor > 0)
30
{
31
REQUIRE_NOTHROW
(
verify_version_compatibility
(api_ver - 100));
32
}
33
if
(minor < 99)
34
{
35
REQUIRE_THROWS
(
verify_version_compatibility
(api_ver + 100));
36
}
37
38
// differences in patch version do not affect compatibility
39
int
base = api_ver -
patch
;
40
for
(
int
i
= 0;
i
< 100;
i
++)
41
{
42
CAPTURE
(base +
i
);
43
REQUIRE_NOTHROW
(
verify_version_compatibility
(base+
i
));
44
}
45
}
find_librs_version.minor
minor
Definition:
find_librs_version.py:23
RS2_API_VERSION
#define RS2_API_VERSION
Definition:
rs.h:41
rs2_get_api_version
int rs2_get_api_version(rs2_error **error)
Definition:
rs.cpp:1184
rs2_error
Definition:
rs.cpp:139
verify_version_compatibility
void verify_version_compatibility(int api_version)
Definition:
api.h:463
test-got-playback-frames.ctx
ctx
Definition:
test-got-playback-frames.py:165
rmse.e
e
Definition:
rmse.py:177
TEST_CASE
TEST_CASE("verify_version_compatibility","[code]")
Definition:
internal-tests-class-logic.cpp:9
rs2_context
Definition:
rs.cpp:82
catch.h
CAPTURE
#define CAPTURE(...)
Definition:
catch.hpp:17432
REQUIRE
REQUIRE(n_callbacks==1)
REQUIRE_THROWS
#define REQUIRE_THROWS(...)
Definition:
catch.hpp:17401
find_librs_version.patch
patch
Definition:
find_librs_version.py:28
find_librs_version.major
major
Definition:
find_librs_version.py:18
REQUIRE_NOTHROW
REQUIRE_NOTHROW(rs2_log(RS2_LOG_SEVERITY_INFO,"Log message using rs2_log()", nullptr))
i
int i
Definition:
rs-pcl-color.cpp:54
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:47:17