summaryrefslogtreecommitdiff
path: root/test/controls/meson.build
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-08-23 16:44:28 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-08-26 01:04:27 +0300
commita7d3570e7c2b33d2d9de2696909524b4bc35fc65 (patch)
treecd80898df0df302a3e2758b8cc7e6c7ff5b37562 /test/controls/meson.build
parenta17f0eddc61486989a375e34dcdcbb15c3152a4a (diff)
utils: Satisfy LegacyInputIterator with StringSplitter::iterator
The StringSplitter::iterator is used with the utils::split() function to iterate over components of a split string. Add the necessary member types expected by std::iterator_trait in order to satisfy the LegacyInputIterator requirement and make the iterator usable in constructors for various containers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'test/controls/meson.build')
0 files changed, 0 insertions, 0 deletions
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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2020, Google Inc.
 *
 * flags.cpp - Flags tests
 */

#include <iostream>

#include <libcamera/base/flags.h>

#include "test.h"

using namespace libcamera;
using namespace std;

class FlagsTest : public Test
{
protected:
	enum class Option {
		First = (1 << 0),
		Second = (1 << 1),
		Third = (1 << 2),
	};

	using Options = Flags<Option>;

	enum class Mode {
		Alpha = (1 << 0),
		Beta = (1 << 1),
		Gamma = (1 << 2),
	};

	using Modes = Flags<Mode>;

	int run() override;
};

namespace libcamera {

LIBCAMERA_FLAGS_ENABLE_OPERATORS(FlagsTest::Option)

} /* namespace libcamera */

int FlagsTest::run()
{
	/* Commented-out constructs are expected not to compile. */

	/* Flags<int> f; */

	/*
	 * Unary operators with enum argument.
	 */

	Options options;

	if (options) {
		cerr << "Default-constructed Flags<> is not zero" << endl;
		return TestFail;
	}

	options |= Option::First;
	if (!options || options != Option::First) {
		cerr << "Unary bitwise OR with enum failed" << endl;
		return TestFail;
	}

	/* options &= Mode::Alpha; */
	/* options |= Mode::Beta;  */
	/* options ^= Mode::Gamma; */

	options &= ~Option::First;
	if (options) {
		cerr << "Unary bitwise AND with enum failed" << endl;
		return TestFail;
	}

	options ^= Option::Second;
	if (options != Option::Second) {
		cerr << "Unary bitwise XOR with enum failed" << endl;
		return TestFail;
	}

	options = Options();