The Battle for Wesnoth
1.13.4+dev
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
tests
utils
predicate.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2008 - 2016 by Pauli Nieminen <
[email protected]
>
3
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY.
11
12
See the COPYING file for more details.
13
*/
14
15
#ifndef TESTS_UTILS_FAKE_DISPLAY_HPP_INCLUDED
16
#define TESTS_UTILS_FAKE_DISPLAY_HPP_INCLUDED
17
18
#include <cstdarg>
19
20
namespace
test_utils
{
21
22
/**
23
* Used to check if first parameter matches one of given values
24
* used with BOOST_CHECK_PREDICATE
25
**/
26
template
<
class
T>
27
bool
one_of
(
const
T&
val
,
int
va_number, ...)
28
{
29
T
param
;
30
va_list vl;
31
va_start(vl, va_number);
32
33
bool
ret =
false
;
34
35
for
(
int
i
= 0;
i
< va_number; ++
i
)
36
{
37
param = va_arg(vl, T);
38
if
(param == val)
39
{
40
ret =
true
;
41
break
;
42
}
43
}
44
va_end(vl);
45
return
ret;
46
}
47
48
49
}
50
#endif
val
GLuint const GLfloat * val
Definition:
glew.h:2614
test_utils::one_of
bool one_of(const T &val, int va_number,...)
Used to check if first parameter matches one of given values used with BOOST_CHECK_PREDICATE.
Definition:
predicate.hpp:27
i
size_t i
Definition:
function.cpp:1057
param
GLfloat param
Definition:
glew.h:1498
test_utils
Definition:
auto_parameterized.hpp:27
Generated by
1.8.8