Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
b
c
d
e
h
i
l
m
n
p
r
s
u
x
Typedefs
b
c
d
e
f
g
i
m
p
r
u
v
Enumerations
Enumerator
a
b
f
g
i
m
n
r
s
u
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
h
i
m
n
p
q
r
s
t
u
v
x
Enumerations
a
c
d
e
f
k
l
m
p
r
s
t
v
w
Enumerator
a
b
d
f
g
h
i
l
m
n
o
p
r
s
u
v
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
b
c
d
e
f
g
m
o
p
r
s
t
u
v
w
Variables
a
b
c
d
e
f
i
k
l
m
n
o
p
r
s
t
w
Typedefs
Enumerations
Enumerator
Macros
_
d
f
i
m
n
p
s
t
u
tests
src
bootloader_version_test.cpp
Go to the documentation of this file.
1
#include <catch2/catch_all.hpp>
2
3
// std
4
#include <array>
5
6
// Include depthai library
7
#include <
depthai/depthai.hpp
>
8
9
using
Version
=
dai::DeviceBootloader::Version
;
10
11
TEST_CASE
(
"Version parsing"
) {
12
// Okay versions
13
{
14
std::string str =
"1.2.3"
;
15
Version
v(0, 0, 0);
16
REQUIRE_NOTHROW(v =
Version
{str});
17
REQUIRE(v.
toString
() == str);
18
}
19
{
20
std::string str =
"4.2.0+c137116638a96d2145ff091235de854890ed56ae"
;
21
Version
v(0, 0, 0);
22
REQUIRE_NOTHROW(v =
Version
{str});
23
REQUIRE(v.
toString
() == str);
24
}
25
26
// Wrong versions
27
// REQUIRE_THROWS(dai::DeviceBootloader::Version("1.2.3.7+abcdef"));
28
REQUIRE_THROWS(
Version
(
"1.7+abcdef"
));
29
REQUIRE_THROWS(
Version
(
"1..7+abcdef"
));
30
REQUIRE_THROWS(
Version
(
"1..7"
));
31
REQUIRE_THROWS(
Version
(
"1..7abcd"
));
32
}
33
34
TEST_CASE
(
"Version comparisons"
) {
35
REQUIRE(
Version
(
"0.0.15+abcdef"
) <
Version
(
"0.0.16"
));
36
REQUIRE(
Version
(
"0.0.15+abcdef"
) <
Version
(
"0.0.15"
));
37
REQUIRE(
Version
(
"0.0.14"
) <
Version
(
"0.0.15"
));
38
REQUIRE(
Version
(
"0.0.14"
) <
Version
(
"0.0.15+abcdef"
));
39
REQUIRE(
Version
(
"0.0.7"
) <
Version
(
"0.0.15+abcdef"
));
40
REQUIRE(
Version
(
"0.0.15+abcdef"
) <
Version
(
"0.1.0"
));
41
42
REQUIRE(
Version
(
"0.0.16"
) >
Version
(
"0.0.15+abcdef"
));
43
REQUIRE(
Version
(
"0.0.15"
) >
Version
(
"0.0.15+abcdef"
));
44
REQUIRE(
Version
(
"0.0.15"
) >
Version
(
"0.0.14"
));
45
REQUIRE(
Version
(
"0.0.15+abcdef"
) >
Version
(
"0.0.14"
));
46
REQUIRE(
Version
(
"0.0.15+abcdef"
) >
Version
(
"0.0.7"
));
47
REQUIRE(
Version
(
"0.1.0"
) >
Version
(
"0.0.15+abcdef"
));
48
49
REQUIRE_FALSE(
Version
(
"0.0.15+abcdef"
) >
Version
(
"0.0.16"
));
50
REQUIRE_FALSE(
Version
(
"0.0.15+abcdef"
) >
Version
(
"0.0.15"
));
51
REQUIRE_FALSE(
Version
(
"0.0.14"
) >
Version
(
"0.0.15"
));
52
REQUIRE_FALSE(
Version
(
"0.0.14"
) >
Version
(
"0.0.15+abcdef"
));
53
REQUIRE_FALSE(
Version
(
"0.0.7"
) >
Version
(
"0.0.15+abcdef"
));
54
REQUIRE_FALSE(
Version
(
"0.0.15+abcdef"
) >
Version
(
"0.1.0"
));
55
REQUIRE_FALSE(
Version
(
"1.2.3"
) >
Version
(
"1.2.3"
));
56
57
REQUIRE_FALSE(
Version
(
"0.0.16"
) <
Version
(
"0.0.15+abcdef"
));
58
REQUIRE_FALSE(
Version
(
"0.0.15"
) <
Version
(
"0.0.15+abcdef"
));
59
REQUIRE_FALSE(
Version
(
"0.0.15"
) <
Version
(
"0.0.14"
));
60
REQUIRE_FALSE(
Version
(
"0.0.15+abcdef"
) <
Version
(
"0.0.14"
));
61
REQUIRE_FALSE(
Version
(
"0.0.15+abcdef"
) <
Version
(
"0.0.7"
));
62
REQUIRE_FALSE(
Version
(
"0.1.0"
) <
Version
(
"0.0.15+abcdef"
));
63
REQUIRE_FALSE(
Version
(0, 0, 18,
"ee0c1c3b0f69888c9f69aa8afcc143c512bfb40d"
) <
Version
(0, 0, 12));
64
REQUIRE_FALSE(
Version
(
"1.2.3"
) <
Version
(
"1.2.3"
));
65
66
REQUIRE(
Version
(
"0.0.15"
) ==
Version
(
"0.0.15"
));
67
REQUIRE(
Version
(
"22.7.15"
) ==
Version
(22, 7, 15));
68
REQUIRE(
Version
(
"0.7.15"
) ==
Version
(0, 7, 15));
69
REQUIRE(
Version
(
"0.7.15+abc123"
) ==
Version
(0, 7, 15,
"abc123"
));
70
REQUIRE(
Version
(
"0.7.15+abc123"
) ==
Version
(
"0.7.15+abc123"
));
71
72
REQUIRE_FALSE(
Version
(
"0.0.15"
) ==
Version
(
"0.0.14"
));
73
REQUIRE_FALSE(
Version
(
"1.0.15"
) ==
Version
(
"0.1.15"
));
74
REQUIRE_FALSE(
Version
(
"1.0.15"
) ==
Version
(
"1.0.14"
));
75
REQUIRE_FALSE(
Version
(
"1.0.15"
) ==
Version
(
"1.0.14+abc123"
));
76
REQUIRE_FALSE(
Version
(
"1.0.15"
) ==
Version
(
"0.0.15+abc123"
));
77
}
Version
dai::DeviceBootloader::Version Version
Definition:
bootloader_version_test.cpp:9
dai::Version
Version structure.
Definition:
Version.hpp:8
depthai.hpp
dai::DeviceBootloader::Version
dai::Version Version
Definition:
DeviceBootloader.hpp:90
dai::Version::toString
std::string toString() const
Convert Version to string.
Definition:
Version.cpp:53
TEST_CASE
TEST_CASE("Version parsing")
Definition:
bootloader_version_test.cpp:11
depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:18