Unverified Commit 34d506f7 authored by Murray Cumming's avatar Murray Cumming
Browse files

Don't return boolean literal from main().

Noticed by a g++ warning.
parent 472055c5
...@@ -262,7 +262,7 @@ int main() ...@@ -262,7 +262,7 @@ int main()
if(!module_names.empty()) //TODO: Test a document that actually has some? if(!module_names.empty()) //TODO: Test a document that actually has some?
{ {
std::cerr << G_STRFUNC << ": Failure: Unexpected library module names.\n"; std::cerr << G_STRFUNC << ": Failure: Unexpected library module names.\n";
return false; return EXIT_FAILURE;
} }
...@@ -272,32 +272,32 @@ int main() ...@@ -272,32 +272,32 @@ int main()
if(print_layout_names.size() != 1) if(print_layout_names.size() != 1)
{ {
std::cerr << G_STRFUNC << ": Failure: Unexpected number of print layouts.\n"; std::cerr << G_STRFUNC << ": Failure: Unexpected number of print layouts.\n";
return false; return EXIT_FAILURE;
} }
if(!contains(print_layout_names, "contact_details")) if(!contains(print_layout_names, "contact_details"))
{ {
std::cerr << G_STRFUNC << ": Failure: Could not find the expected print layout name.\n"; std::cerr << G_STRFUNC << ": Failure: Could not find the expected print layout name.\n";
return false; return EXIT_FAILURE;
} }
const auto print_layout = document->get_print_layout("contacts", "contact_details"); const auto print_layout = document->get_print_layout("contacts", "contact_details");
if(!print_layout) if(!print_layout)
{ {
std::cerr << G_STRFUNC << ": Failure: Could not get an expected print layout.\n"; std::cerr << G_STRFUNC << ": Failure: Could not get an expected print layout.\n";
return false; return EXIT_FAILURE;
} }
if(print_layout->get_title_original() != "Contact Details") if(print_layout->get_title_original() != "Contact Details")
{ {
std::cerr << G_STRFUNC << ": Failure: Unexpected print layout title.\n"; std::cerr << G_STRFUNC << ": Failure: Unexpected print layout title.\n";
return false; return EXIT_FAILURE;
} }
if(!print_layout->get_layout_group()) if(!print_layout->get_layout_group())
{ {
std::cerr << G_STRFUNC << ": Failure: The print layout has no layout group.\n"; std::cerr << G_STRFUNC << ": Failure: The print layout has no layout group.\n";
return false; return EXIT_FAILURE;
} }
...@@ -306,32 +306,32 @@ int main() ...@@ -306,32 +306,32 @@ int main()
if(report_names.size() != 2) if(report_names.size() != 2)
{ {
std::cerr << G_STRFUNC << ": Failure: Unexpected number of reports.\n"; std::cerr << G_STRFUNC << ": Failure: Unexpected number of reports.\n";
return false; return EXIT_FAILURE;
} }
if(!contains(report_names, "by_country")) if(!contains(report_names, "by_country"))
{ {
std::cerr << G_STRFUNC << ": Failure: Could not find the expected report name.\n"; std::cerr << G_STRFUNC << ": Failure: Could not find the expected report name.\n";
return false; return EXIT_FAILURE;
} }
const auto report = document->get_report("contacts", "by_country_by_town"); const auto report = document->get_report("contacts", "by_country_by_town");
if(!report) if(!report)
{ {
std::cerr << G_STRFUNC << ": Failure: Could not get an expected report.\n"; std::cerr << G_STRFUNC << ": Failure: Could not get an expected report.\n";
return false; return EXIT_FAILURE;
} }
if(report->get_title_original() != "By Country, By Town") if(report->get_title_original() != "By Country, By Town")
{ {
std::cerr << G_STRFUNC << ": Failure: Unexpected report title.\n"; std::cerr << G_STRFUNC << ": Failure: Unexpected report title.\n";
return false; return EXIT_FAILURE;
} }
if(!report->get_layout_group()) if(!report->get_layout_group())
{ {
std::cerr << G_STRFUNC << ": Failure: The report has no layout group.\n"; std::cerr << G_STRFUNC << ": Failure: The report has no layout group.\n";
return false; return EXIT_FAILURE;
} }
...@@ -356,13 +356,13 @@ int main() ...@@ -356,13 +356,13 @@ int main()
if(!needs_navigation(document, "scenes", "location_id")) if(!needs_navigation(document, "scenes", "location_id"))
{ {
std::cerr << G_STRFUNC << ": Failure: DbUtils::layout_field_should_have_navigation() did not return the expected result.\n"; std::cerr << G_STRFUNC << ": Failure: DbUtils::layout_field_should_have_navigation() did not return the expected result.\n";
return false; return EXIT_FAILURE;
} }
if(needs_navigation(document, "scenes", "description")) if(needs_navigation(document, "scenes", "description"))
{ {
std::cerr << G_STRFUNC << ": Failure: DbUtils::layout_field_should_have_navigation() did not return the expected result.\n"; std::cerr << G_STRFUNC << ": Failure: DbUtils::layout_field_should_have_navigation() did not return the expected result.\n";
return false; return EXIT_FAILURE;
} }
...@@ -375,7 +375,7 @@ int main() ...@@ -375,7 +375,7 @@ int main()
if(!portal) if(!portal)
{ {
std::cerr << G_STRFUNC << ": Failure: Could not get the portal from the layout.\n"; std::cerr << G_STRFUNC << ": Failure: Could not get the portal from the layout.\n";
return false; return EXIT_FAILURE;
} }
Glib::ustring navigation_table_name; Glib::ustring navigation_table_name;
...@@ -385,19 +385,19 @@ int main() ...@@ -385,19 +385,19 @@ int main()
if(navigation_table_name != "characters") if(navigation_table_name != "characters")
{ {
std::cerr << G_STRFUNC << ": Failure: get_suitable_table_to_view_details() returned an unexpected table name: " << navigation_table_name << std::endl; std::cerr << G_STRFUNC << ": Failure: get_suitable_table_to_view_details() returned an unexpected table name: " << navigation_table_name << std::endl;
return false; return EXIT_FAILURE;
} }
if(!navigation_relationship) if(!navigation_relationship)
{ {
std::cerr << G_STRFUNC << ": Failure: get_suitable_table_to_view_details() returned an empty navigation_relationship.\n"; std::cerr << G_STRFUNC << ": Failure: get_suitable_table_to_view_details() returned an empty navigation_relationship.\n";
return false; return EXIT_FAILURE;
} }
if(navigation_relationship->get_relationship_name() != "cast") if(navigation_relationship->get_relationship_name() != "cast")
{ {
std::cerr << G_STRFUNC << ": Failure: get_suitable_table_to_view_details() returned an unexpected navigation_relationship name: " << navigation_relationship->get_relationship_name() << std::endl; std::cerr << G_STRFUNC << ": Failure: get_suitable_table_to_view_details() returned an unexpected navigation_relationship name: " << navigation_relationship->get_relationship_name() << std::endl;
return false; return EXIT_FAILURE;
} }
Glom::libglom_deinit(); Glom::libglom_deinit();
......
...@@ -105,14 +105,14 @@ int main() ...@@ -105,14 +105,14 @@ int main()
if(document->get_field(table_name, field_name_original)) if(document->get_field(table_name, field_name_original))
{ {
std::cerr << G_STRFUNC << ": Failure: The document should have forgotten about the original field name.\n"; std::cerr << G_STRFUNC << ": Failure: The document should have forgotten about the original field name.\n";
return false; return EXIT_FAILURE;
} }
//Check that the new field name is known to the document: //Check that the new field name is known to the document:
if(!(document->get_field(table_name, field_name_new))) if(!(document->get_field(table_name, field_name_new)))
{ {
std::cerr << G_STRFUNC << ": Failure: The document does not know about the new field name.\n"; std::cerr << G_STRFUNC << ": Failure: The document does not know about the new field name.\n";
return false; return EXIT_FAILURE;
} }
//Check that the original field name is no longer used in the relationship: //Check that the original field name is no longer used in the relationship:
...@@ -120,20 +120,20 @@ int main() ...@@ -120,20 +120,20 @@ int main()
if(!relationship) if(!relationship)
{ {
std::cerr << G_STRFUNC << ": Failure: The relationship could not be found in the document.\n"; std::cerr << G_STRFUNC << ": Failure: The relationship could not be found in the document.\n";
return false; return EXIT_FAILURE;
} }
if(relationship->get_to_field() == field_name_original) if(relationship->get_to_field() == field_name_original)
{ {
std::cerr << G_STRFUNC << ": Failure: The relationship still uses the original field name.\n"; std::cerr << G_STRFUNC << ": Failure: The relationship still uses the original field name.\n";
return false; return EXIT_FAILURE;
} }
//Check that the original field name is no longer used on a layout: //Check that the original field name is no longer used on a layout:
if(field_is_on_a_layout(document, table_name, field_name_original)) if(field_is_on_a_layout(document, table_name, field_name_original))
{ {
std::cerr << G_STRFUNC << ": Failure: The original field name is still used on a layout.\n"; std::cerr << G_STRFUNC << ": Failure: The original field name is still used on a layout.\n";
return false; return EXIT_FAILURE;
} }
{ {
...@@ -146,13 +146,13 @@ int main() ...@@ -146,13 +146,13 @@ int main()
if(document->get_relationship(table_name, relationship_name_original)) if(document->get_relationship(table_name, relationship_name_original))
{ {
std::cerr << G_STRFUNC << ": Failure: The original relationship name still exists.\n"; std::cerr << G_STRFUNC << ": Failure: The original relationship name still exists.\n";
return false; return EXIT_FAILURE;
} }
if(!document->get_relationship(table_name, relationship_name_new)) if(!document->get_relationship(table_name, relationship_name_new))
{ {
std::cerr << G_STRFUNC << ": Failure: The new relationship name does not exist.\n"; std::cerr << G_STRFUNC << ": Failure: The new relationship name does not exist.\n";
return false; return EXIT_FAILURE;
} }
//Check that the old relationship name is not used. //Check that the old relationship name is not used.
...@@ -162,7 +162,7 @@ int main() ...@@ -162,7 +162,7 @@ int main()
if(field_on_layout->get_relationship_name() != relationship_name_new) if(field_on_layout->get_relationship_name() != relationship_name_new)
{ {
std::cerr << G_STRFUNC << ": Failure: A layout item does not use the new relationship name as expected.\n"; std::cerr << G_STRFUNC << ": Failure: A layout item does not use the new relationship name as expected.\n";
return false; return EXIT_FAILURE;
} }
} }
...@@ -171,7 +171,7 @@ int main() ...@@ -171,7 +171,7 @@ int main()
if(field_is_on_a_layout(document, "publisher", "publisher_id")) if(field_is_on_a_layout(document, "publisher", "publisher_id"))
{ {
std::cerr << G_STRFUNC << ": Failure: The removed field name is still used on a layout.\n"; std::cerr << G_STRFUNC << ": Failure: The removed field name is still used on a layout.\n";
return false; return EXIT_FAILURE;
} }
//Remove a relationship: //Remove a relationship:
...@@ -180,7 +180,7 @@ int main() ...@@ -180,7 +180,7 @@ int main()
if(relationship) if(relationship)
{ {
std::cerr << G_STRFUNC << ": Failure: The removed relationship still exists.\n"; std::cerr << G_STRFUNC << ": Failure: The removed relationship still exists.\n";
return false; return EXIT_FAILURE;
} }
//Change a table name: //Change a table name:
...@@ -189,27 +189,27 @@ int main() ...@@ -189,27 +189,27 @@ int main()
if(document->get_table("invoice_lines")) if(document->get_table("invoice_lines"))
{ {
std::cerr << G_STRFUNC << ": Failure: The renamed table still exists.\n"; std::cerr << G_STRFUNC << ": Failure: The renamed table still exists.\n";
return false; return EXIT_FAILURE;
} }
relationship = document->get_relationship("invoices", "invoice_lines"); relationship = document->get_relationship("invoices", "invoice_lines");
if(!relationship) if(!relationship)
{ {
std::cerr << G_STRFUNC << ": Failure: The expected relationship does not exist.\n"; std::cerr << G_STRFUNC << ": Failure: The expected relationship does not exist.\n";
return false; return EXIT_FAILURE;
} }
if(relationship->get_to_table() != table_renamed) if(relationship->get_to_table() != table_renamed)
{ {
std::cerr << G_STRFUNC << ": Failure: The relationship's to_table does have been renamed.\n"; std::cerr << G_STRFUNC << ": Failure: The relationship's to_table does have been renamed.\n";
return false; return EXIT_FAILURE;
} }
document->remove_table("products"); document->remove_table("products");
if(document->get_table("products")) if(document->get_table("products"))
{ {
std::cerr << G_STRFUNC << ": Failure: The removed table still exists.\n"; std::cerr << G_STRFUNC << ": Failure: The removed table still exists.\n";
return false; return EXIT_FAILURE;
} }
...@@ -219,7 +219,7 @@ int main() ...@@ -219,7 +219,7 @@ int main()
if(!print_layout) if(!print_layout)
{ {
std::cerr << G_STRFUNC << ": Failure: Could not get an expected print layout.\n"; std::cerr << G_STRFUNC << ": Failure: Could not get an expected print layout.\n";
return false; return EXIT_FAILURE;
} }
document->remove_print_layout("contacts", "contact_details"); document->remove_print_layout("contacts", "contact_details");
...@@ -228,7 +228,7 @@ int main() ...@@ -228,7 +228,7 @@ int main()
if(print_layout) if(print_layout)
{ {
std::cerr << G_STRFUNC << ": Failure: The removed print layotu still exists.\n"; std::cerr << G_STRFUNC << ": Failure: The removed print layotu still exists.\n";
return false; return EXIT_FAILURE;
} }
//Test user groups: //Test user groups:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment