libdballe  6.8
tests.h
1 /*
2  * Copyright (C) 2013 ARPA-SIM <urpsim@smr.arpa.emr.it>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Author: Enrico Zini <enrico@enricozini.com>
18  */
19 #ifndef DBA_MEMDB_TESTS_H
20 #define DBA_MEMDB_TESTS_H
21 
22 #include <dballe/core/test-utils-core.h>
23 #include <dballe/memdb/results.h>
24 #include <vector>
25 #include <iterator>
26 
27 namespace dballe {
28 struct Memdb;
29 
30 namespace memdb {
31 struct Value;
32 }
33 
34 namespace tests {
35 
36 template<typename T>
37 static inline std::vector<const T*> _get_results(WIBBLE_TEST_LOCPRM, memdb::Results<T>& res)
38 {
39  using namespace wibble::tests;
40 
41  wassert(actual(res.is_select_all()).isfalse());
42  wassert(actual(res.is_empty()).isfalse());
43  std::vector<const T*> items;
44  res.copy_valptrs_to(std::back_inserter(items));
45  return items;
46 }
47 
48 #define get_results(res) _get_results(wibble_test_location.nest(wibble_test_location_info, __FILE__, __LINE__, "get_results(" #res ")"), res)
49 
50 /*
51 std::vector<const memdb::Value*> _get_data_results(WIBBLE_TEST_LOCPRM, const Memdb& memdb, const Record& query);
52 #define get_data_results(memdb, query) _get_data_results(wibble_test_location.nest(wibble_test_location_info, __FILE__, __LINE__, "get_data_results(" #memdb ", " #query ")"), memdb, query)
53 */
54 
55 }
56 }
57 
58 #endif
Definition: cmdline.h:34