static void test_Dump_Load_and_Equals(TestBatchRunner *runner) { Query *a_leaf = (Query*)TestUtils_make_leaf_query(NULL, "a"); Query *b_leaf = (Query*)TestUtils_make_leaf_query(NULL, "b"); NOTQuery *query = NOTQuery_new(a_leaf); NOTQuery *kids_differ = NOTQuery_new(b_leaf); NOTQuery *boost_differs = NOTQuery_new(a_leaf); Obj *dump = (Obj*)NOTQuery_Dump(query); NOTQuery *clone = (NOTQuery*)Obj_Load(dump, dump); TEST_FALSE(runner, NOTQuery_Equals(query, (Obj*)kids_differ), "Different kids spoil Equals"); TEST_TRUE(runner, NOTQuery_Equals(query, (Obj*)boost_differs), "Equals with identical boosts"); NOTQuery_Set_Boost(boost_differs, 1.5); TEST_FALSE(runner, NOTQuery_Equals(query, (Obj*)boost_differs), "Different boost spoils Equals"); TEST_TRUE(runner, NOTQuery_Equals(query, (Obj*)clone), "Dump => Load round trip"); DECREF(a_leaf); DECREF(b_leaf); DECREF(query); DECREF(kids_differ); DECREF(boost_differs); DECREF(dump); DECREF(clone); }
Query* QParser_Make_NOT_Query_IMP(QueryParser *self, Query *negated_query) { UNUSED_VAR(self); return (Query*)NOTQuery_new(negated_query); }