static void test_bool_fcn (QofBook *book, const char *message, void (*set) (GncEmployee *, gboolean), gboolean (*get) (const GncEmployee *)) { GncEmployee *employee = gncEmployeeCreate (book); gboolean num = get_random_boolean (); do_test (!gncEmployeeIsDirty (employee), "test if start dirty"); gncEmployeeBeginEdit (employee); set (employee, FALSE); set (employee, TRUE); set (employee, num); /* Employee record should be dirty */ do_test (gncEmployeeIsDirty (employee), "test dirty later"); gncEmployeeCommitEdit (employee); /* Employee record should be not dirty */ /* Skip, because will always fail without a backend. * It's not possible to load a backend in the engine code * without having circular dependencies. */ // do_test (!gncEmployeeIsDirty (employee), "test dirty after commit"); do_test (get (employee) == num, message); gncEmployeeSetActive (employee, FALSE); count++; }
mychild* child_create(QofBook *book) { mychild *g; g_return_val_if_fail(book, NULL); g = g_object_new(GNC_TYPE_MYCHILD, NULL); qof_instance_init_data (&g->inst, CHILD_MODULE_NAME, book); g->date = *get_random_timespec(); g->discount = get_random_double(); g->active = get_random_boolean(); g->version = get_random_int_in_range(1, 10000); g->minor = get_random_int_in_range(100001, 99999999); g->flag = get_random_character(); g->Name = get_random_string(); g->Amount = get_random_gnc_numeric(); qof_event_gen(&g->inst, QOF_EVENT_CREATE, NULL); return g; }
static void test_bool_fcn (QofBook *book, const char *message, void (*set) (GncEmployee *, gboolean), gboolean (*get) (const GncEmployee *)) { GncEmployee *employee = gncEmployeeCreate (book); gboolean num = get_random_boolean (); do_test (!gncEmployeeIsDirty (employee), "test if start dirty"); gncEmployeeBeginEdit (employee); set (employee, FALSE); set (employee, TRUE); set (employee, num); do_test (gncEmployeeIsDirty (employee), "test dirty later"); gncEmployeeCommitEdit (employee); do_test (gncEmployeeIsDirty (employee), "test dirty after commit"); do_test (get (employee) == num, message); gncEmployeeSetActive (employee, FALSE); count++; }