/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2019, Google Inc. * * control_value.cpp - ControlValue tests */ #include #include #include "test.h" using namespace std; using namespace libcamera; class ControlValueTest : public Test { protected: int run() { ControlValue integer(1234); ControlValue boolean(true); /* Just a string conversion output test... no validation */ cout << "Int: " << integer.toString() << " Bool: " << boolean.toString() << endl; if (integer.getInt() != 1234) { cerr << "Failed to get Integer" << endl; return TestFail; } if (boolean.getBool() != true) { cerr << "Failed to get Boolean" << endl; return TestFail; } /* Test an uninitialised value, and updating it. */ ControlValue value; if (!value.isNone()) { cerr << "Empty value is non-null" << endl; return TestFail; } value.set(true); if (value.isNone()) { cerr << "Failed to set an empty object" << endl; return TestFail; } if (value.getBool() != true) { cerr << "Failed to get Booleans" << endl; return TestFail; } value.set(10); if (value.getInt() != 10) { cerr << "Failed to get Integer" << endl; return TestFail; } return TestPass; } }; TEST_REGISTER(ControlValueTest) /option> Jacopo Mondi's clone of libcameragit repository hosting on libcamera.org
summaryrefslogtreecommitdiff
blob: d6fc1ecc01bf34208f14ba5ae9c6f7497f21a8e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111