int main (int argc, char *argv[]) { sqlite3 *db_handle; int ret; const char *sql; void *cache = NULL; char *sql_err = NULL; if (argc > 1 || argv[0] == NULL) argc = 1; /* silencing stupid compiler warnings */ do_unlink_all (); /* directly testing GPKG */ ret = system ("cp ./gpkg_test.gpkg copy-gpkg_test.gpkg"); if (ret != 0) { fprintf (stderr, "cannot copy gpkg_test.gpkg database\n"); return -1; } cache = spatialite_alloc_connection (); ret = sqlite3_open_v2 ("./copy-gpkg_test.gpkg", &db_handle, SQLITE_OPEN_READWRITE, NULL); if (ret != SQLITE_OK) { fprintf (stderr, "cannot open '%s': %s\n", "copy-gpkg_test.gpkg", sqlite3_errmsg (db_handle)); do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } spatialite_init_ex (db_handle, cache, 0); if (!test_table (db_handle, "pt2d")) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_table (db_handle, "ln3dz")) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_table (db_handle, "pg2dm")) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_table (db_handle, "mpt3dzm")) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_table (db_handle, "mln2dm")) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_table (db_handle, "mpg3dz")) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_table (db_handle, "gc3dz")) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } /* activating Auto GPKG Wrapping */ sql = "SELECT AutoGPKGStart()"; ret = sqlite3_exec (db_handle, sql, NULL, NULL, &sql_err); if (ret != SQLITE_OK) { fprintf (stderr, "AutoGPKGStart error: %s\n", sql_err); sqlite3_free (sql_err); do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } /* testing the Virtual Tables */ if (!test_vtable (db_handle, "pt2d", 0)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_vtable (db_handle, "ln3dz", 0)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_vtable (db_handle, "pg2dm", 0)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_vtable (db_handle, "mpt3dzm", 0)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_vtable (db_handle, "mln2dm", 0)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_vtable (db_handle, "mpg3dz", 0)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_vtable (db_handle, "gc3dz", 0)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_vtable (db_handle, "test_pk", 1)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } if (!test_vtable_out (db_handle)) { do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } /* quitting Auto GPKG Wrapping */ sql = "SELECT AutoGPKGStop()"; ret = sqlite3_exec (db_handle, sql, NULL, NULL, &sql_err); if (ret != SQLITE_OK) { fprintf (stderr, "AutoGPKGStop error: %s\n", sql_err); sqlite3_free (sql_err); do_unlink_all (); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); return -1; } sqlite3_close (db_handle); spatialite_cleanup_ex (cache); spatialite_shutdown (); do_unlink_all (); return 0; }
static int test_table_pos(int idx) { return test_table(tbl_testdata_pos, idx); }
static int test_table_neg_64bit(int idx) { return test_table(tbl_testdata_neg_64bit, idx); }
int main(int c, char** args) { test_table(); std::cin.ignore(); return 0; }
int main(int argc, char **argv) { test_table(architecture, ARCHITECTURE); test_table(automount_result, AUTOMOUNT_RESULT); test_table(automount_state, AUTOMOUNT_STATE); test_table(bus_policy_access, BUS_POLICY_ACCESS); test_table(busname_result, BUSNAME_RESULT); test_table(busname_state, BUSNAME_STATE); test_table(cgroup_device_policy, CGROUP_DEVICE_POLICY); test_table(condition_type, CONDITION_TYPE); test_table(assert_type, CONDITION_TYPE); test_table(condition_result, CONDITION_RESULT); test_table(device_state, DEVICE_STATE); test_table(exec_input, EXEC_INPUT); test_table(exec_output, EXEC_OUTPUT); test_table(failure_action, FAILURE_ACTION); test_table(job_mode, JOB_MODE); test_table(job_result, JOB_RESULT); test_table(job_state, JOB_STATE); test_table(job_type, JOB_TYPE); test_table(kill_mode, KILL_MODE); test_table(kill_who, KILL_WHO); test_table(log_target, LOG_TARGET); test_table(mac_policy, MACPOLICY); test_table(manager_state, MANAGER_STATE); test_table(mount_exec_command, MOUNT_EXEC_COMMAND); test_table(mount_result, MOUNT_RESULT); test_table(mount_state, MOUNT_STATE); test_table(name_policy, NAMEPOLICY); test_table(notify_access, NOTIFY_ACCESS); test_table(output_mode, OUTPUT_MODE); test_table(path_result, PATH_RESULT); test_table(path_state, PATH_STATE); test_table(path_type, PATH_TYPE); test_table(policy_item_class, POLICY_ITEM_CLASS); test_table(policy_item_type, POLICY_ITEM_TYPE); test_table(protect_home, PROTECT_HOME); test_table(protect_system, PROTECT_SYSTEM); test_table(rlimit, RLIMIT); test_table(scope_result, SCOPE_RESULT); test_table(scope_state, SCOPE_STATE); test_table(service_exec_command, SERVICE_EXEC_COMMAND); test_table(service_restart, SERVICE_RESTART); test_table(service_result, SERVICE_RESULT); test_table(service_state, SERVICE_STATE); test_table(service_type, SERVICE_TYPE); test_table(slice_state, SLICE_STATE); test_table(snapshot_state, SNAPSHOT_STATE); test_table(socket_address_bind_ipv6_only, SOCKET_ADDRESS_BIND_IPV6_ONLY); test_table(socket_exec_command, SOCKET_EXEC_COMMAND); test_table(socket_result, SOCKET_RESULT); test_table(socket_state, SOCKET_STATE); test_table(split_mode, SPLIT); test_table(storage, STORAGE); test_table(swap_exec_command, SWAP_EXEC_COMMAND); test_table(swap_result, SWAP_RESULT); test_table(swap_state, SWAP_STATE); test_table(target_state, TARGET_STATE); test_table(timer_base, TIMER_BASE); test_table(timer_result, TIMER_RESULT); test_table(timer_state, TIMER_STATE); test_table(unit_active_state, UNIT_ACTIVE_STATE); test_table(unit_dependency, UNIT_DEPENDENCY); test_table(unit_file_change_type, UNIT_FILE_CHANGE_TYPE); test_table(unit_file_preset_mode, UNIT_FILE_PRESET); test_table(unit_file_state, UNIT_FILE_STATE); test_table(unit_load_state, UNIT_LOAD_STATE); test_table(unit_type, UNIT_TYPE); test_table(locale_variable, VARIABLE_LC); test_table_sparse(object_compressed, OBJECT_COMPRESSED); return EXIT_SUCCESS; }
static int test_table_neg(int idx) { return test_table(tbl_testdata_neg, idx); }
int main(int argc, char **argv) { test_table(resolv_conf_mode, RESOLV_CONF_MODE); test_table(timezone_mode, TIMEZONE_MODE); return 0; }
static void validate_accessible (Accessible *accessible, gboolean has_parent, gboolean recurse_down) { Accessible *tmp; char *name, *descr; AccessibleRole role; AccessibleRelation **relations; char *role_name; GString *item_str = g_string_new (""); int i; name = Accessible_getName (accessible); g_assert (name != NULL); descr = Accessible_getDescription (accessible); g_assert (descr != NULL); role = Accessible_getRole (accessible); g_assert (role != SPI_ROLE_INVALID); role_name = Accessible_getRoleName (accessible); g_assert (role_name != NULL); relations = Accessible_getRelationSet (accessible); g_assert (relations != NULL); for (i = 0; relations [i]; i++) { AccessibleRelationType type; int targets; fprintf (stderr, "relation %d\n", i); type = AccessibleRelation_getRelationType (relations [i]); g_assert (type != SPI_RELATION_NULL); targets = AccessibleRelation_getNTargets (relations [i]); g_assert (targets != -1); AccessibleRelation_unref (relations [i]); relations [i] = NULL; } free (relations); if (print_tree) { int i; for (i = 0; i < print_tree_depth; i++) fputc (' ', stderr); fputs ("|-> [ ", stderr); } if (Accessible_isAction (accessible)) { tmp = Accessible_getAction (accessible); g_assert (tmp != NULL); if (print_tree) fprintf (stderr, "At"); else test_action (tmp); AccessibleAction_unref (tmp); } if (Accessible_isApplication (accessible)) { tmp = Accessible_getApplication (accessible); if (print_tree) fprintf (stderr, "Ap"); else test_application (tmp); AccessibleApplication_unref (tmp); } if (Accessible_isComponent (accessible)) { tmp = Accessible_getComponent (accessible); g_assert (tmp != NULL); if (print_tree) fprintf (stderr, "Co"); else test_component (tmp); AccessibleComponent_unref (tmp); } if (Accessible_isEditableText (accessible)) { tmp = Accessible_getEditableText (accessible); g_assert (tmp != NULL); if (print_tree) fprintf (stderr, "Et"); else test_editable_text (tmp); AccessibleEditableText_unref (tmp); } if (Accessible_isHypertext (accessible)) { tmp = Accessible_getHypertext (accessible); g_assert (tmp != NULL); if (print_tree) fprintf (stderr, "Ht"); AccessibleHypertext_unref (tmp); } if (Accessible_isImage (accessible)) { tmp = Accessible_getImage (accessible); g_assert (tmp != NULL); if (print_tree) { char *desc; fprintf (stderr, "Im"); desc = AccessibleImage_getImageDescription (tmp); g_string_append_printf ( item_str, " image descr: '%s'", desc); SPI_freeString (desc); } else test_image (tmp); AccessibleImage_unref (tmp); } if (Accessible_isSelection (accessible)) { tmp = Accessible_getSelection (accessible); g_assert (tmp != NULL); if (print_tree) fprintf (stderr, "Se"); AccessibleSelection_unref (tmp); } if (Accessible_isTable (accessible)) { tmp = Accessible_getTable (accessible); g_assert (tmp != NULL); if (print_tree) fprintf (stderr, "Ta"); else test_table (tmp); AccessibleTable_unref (tmp); } if (Accessible_isText (accessible)) { tmp = Accessible_getText (accessible); g_assert (tmp != NULL); if (print_tree) fprintf (stderr, "Te"); else { if (strcmp (name, TEST_STRING_A_OBJECT) == 0) test_text (tmp); } AccessibleText_unref (tmp); } if (Accessible_isValue (accessible)) { tmp = Accessible_getValue (accessible); g_assert (tmp != NULL); if (print_tree) fprintf (stderr, "Va"); else test_value (tmp); AccessibleValue_unref (tmp); } if (print_tree) fprintf (stderr, " ] '%s' (%s) - %s: %s\n", name, descr, role_name, item_str->str); SPI_freeString (name); SPI_freeString (descr); SPI_freeString (role_name); g_string_free (item_str, TRUE); validate_tree (accessible, has_parent, recurse_down); }
int main(int argc, char **argv) { test_table(address_family_boolean, ADDRESS_FAMILY_BOOLEAN); test_table(bond_ad_select, NETDEV_BOND_AD_SELECT); test_table(bond_arp_all_targets, NETDEV_BOND_ARP_ALL_TARGETS); test_table(bond_arp_validate, NETDEV_BOND_ARP_VALIDATE); test_table(bond_fail_over_mac, NETDEV_BOND_FAIL_OVER_MAC); test_table(bond_lacp_rate, NETDEV_BOND_LACP_RATE); test_table(bond_mode, NETDEV_BOND_MODE); test_table(bond_primary_reselect, NETDEV_BOND_PRIMARY_RESELECT); test_table(bond_xmit_hash_policy, NETDEV_BOND_XMIT_HASH_POLICY); test_table(dhcp6_message_status, DHCP6_STATUS); test_table_sparse(dhcp6_message_type, DHCP6_MESSAGE); /* enum starts from 1 */ test_table(dhcp_use_domains, DHCP_USE_DOMAINS); test_table(duplex, DUP); test_table(ip6tnl_mode, NETDEV_IP6_TNL_MODE); test_table(ipv6_privacy_extensions, IPV6_PRIVACY_EXTENSIONS); test_table(ipvlan_flags, NETDEV_IPVLAN_FLAGS); test_table(link_operstate, LINK_OPERSTATE); /* test_table(link_state, LINK_STATE); — not a reversible mapping */ test_table(lldp_mode, LLDP_MODE); test_table(netdev_kind, NETDEV_KIND); test_table(nl_union_link_info_data, NL_UNION_LINK_INFO_DATA); test_table(wol, WOL); test_table_sparse(dhcp6_message_type, DHCP6_MESSAGE); test_table_sparse(ipvlan_mode, NETDEV_IPVLAN_MODE); test_table_sparse(macvlan_mode, NETDEV_MACVLAN_MODE); return EXIT_SUCCESS; }
void test_all(uint p) { test_euclid(p); test_table(p); test_cache(p); }
void test_dl_bitvector_table() { test_table(mk_bv_table); }