17 static class QofFakeQueryPool
24 m_queriesNew.push_back(query);
32 auto it = std::find_if(m_queriesNew.begin(), m_queriesNew.end(),
34 return (g_strcmp0(query->m_obj_type, obj_type) == 0);
36 if (it != m_queriesNew.end())
39 m_queriesNew.erase(it);
40 m_queriesUsed.push_back(query);
43 EXPECT_NE(query,
nullptr);
51 auto it = std::find(m_queriesUsed.begin(), m_queriesUsed.end(), (
QofFakeQuery*)query);
53 return (it != m_queriesUsed.end());
60 ASSERT_TRUE(query_used((
QofQuery*)query));
61 auto it = std::find(m_queriesUsed.begin(), m_queriesUsed.end(), query);
62 m_queriesConsumed.push_back(*it);
63 m_queriesUsed.erase(it);
69 ASSERT_FALSE(query_used((
QofQuery*)query));
70 auto it = std::find(m_queriesConsumed.begin(), m_queriesConsumed.end(), (
QofFakeQuery*)query);
71 if (it != m_queriesConsumed.end())
72 m_queriesConsumed.erase(it);
75 it = std::find(m_queriesNew.begin(), m_queriesNew.end(), (
QofFakeQuery*)query);
76 bool query_found = (it != m_queriesNew.end());
77 ASSERT_TRUE(query_found);
78 m_queriesNew.erase(it);
83 std::list<QofFakeQuery*> m_queriesNew {};
84 std::list<QofFakeQuery*> m_queriesUsed {};
85 std::list<QofFakeQuery*> m_queriesConsumed {};
95 queryPool.add_query(
this);
98 QofFakeQuery::~QofFakeQuery()
100 queryPool.remove_query(
this);
110 return (
QofQuery*)queryPool.request_query(obj_type);
122 ASSERT_TRUE(queryPool.query_used(query));
123 ASSERT_TRUE(QOF_IS_BOOK(book));
128 xaccQueryAddDateMatchTT (
136 ASSERT_TRUE(queryPool.query_used(query));
137 ((
QofFakeQuery*)query)->add_date_match_tt(use_start, stt, use_end, ett, op);
143 ASSERT_TRUE(queryPool.query_used(query));
144 ((
QofFakeQuery*)query)->add_single_account_match(acc, op);
151 GList *matching_objects = NULL;
152 bool query_used = queryPool.query_used(query);
154 EXPECT_TRUE(query_used);
159 for (
auto object : matchingObjects)
161 matching_objects = g_list_append(matching_objects, static_cast<gpointer>(
object));
165 return matching_objects;
const gchar * QofIdTypeConst
QofIdTypeConst declaration.
void qof_query_destroy(QofQuery *query)
Frees the resources associate with a Query object.
void qof_query_set_book(QofQuery *query, QofBook *book)
Set the book to be searched.
Encapsulate all the information about a dataset.
QofQueryOp
Query Term Operators, for combining Query Terms.
GList * qof_query_run(QofQuery *query)
Perform the query, return the results.
Fake object providing functionality similar to QofQuery.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...