00001 /* $Id: predicate.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2008 - 2012 by Pauli Nieminen <paniemin@cc.hut.fi> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 00016 #ifndef TESTS_UTILS_FAKE_DISPLAY_HPP_INCLUDED 00017 #define TESTS_UTILS_FAKE_DISPLAY_HPP_INCLUDED 00018 00019 #include <cstdarg> 00020 00021 namespace test_utils { 00022 00023 /** 00024 * Used to check if first parameter matches one of given values 00025 * used with BOOST_CHECK_PREDICATE 00026 **/ 00027 template<class T> 00028 bool one_of(const T& val, int va_number, ...) 00029 { 00030 T param; 00031 va_list vl; 00032 va_start(vl, va_number); 00033 00034 bool ret = false; 00035 00036 for (int i = 0; i < va_number; ++i) 00037 { 00038 param = va_arg(vl, T); 00039 if (param == val) 00040 { 00041 ret = true; 00042 break; 00043 } 00044 } 00045 va_end(vl); 00046 return ret; 00047 } 00048 00049 00050 } 00051 #endif
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:12 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |