[Commits] [wesnoth/wesnoth] 426721: repair unit_map unit tests
GitHub
noreply at github.com
Tue Mar 11 04:28:09 UTC 2014
Branch: refs/heads/master
Home: https://github.com/wesnoth/wesnoth
Commit: 426721f03f46b9a74387498df065ba1d1687e65e
https://github.com/wesnoth/wesnoth/commit/426721f03f46b9a74387498df065ba1d1687e65e
Author: Chris Beck <render787 at gmail.com>
Date: 2014-03-11 (Tue, 11 Mar 2014)
Changed paths:
M src/tests/test_unit_map.cpp
M src/unit.cpp
Log Message:
-----------
repair unit_map unit tests
in an earlier commit these tests were disabled because they were segfaulting
and blocking the test suite from running. the cause was obscure: the tests
were based on making a dummy unit type and inserting / reinserting it
into the unit_map. however, it turns out that in the current code, a freshly
constructed unit_type is not safe to be used to construct a unit. the reason
is that then it does not have any genders defined, so when the unit is built
it will not find any genders and fail with segfault, or even more bizarrely,
a division by zero error. i found that even running with gdb did not give
an actual line number, and simply said that the failure occurred in the
unit constructor, a function whose initalizer list spans several pages.
the correct fix is to invoke "unit_types.build_unit_type" on the unit type
before using it. this permits the unit tests to run.
additionally i added an assert to the generate_genders function in unit.cpp,
which surely should have been there in the first place.
Commit: ae0265fabf9574b36c0de024eda78f5d6fc05367
https://github.com/wesnoth/wesnoth/commit/ae0265fabf9574b36c0de024eda78f5d6fc05367
Author: Chris Beck <render787 at gmail.com>
Date: 2014-03-11 (Tue, 11 Mar 2014)
Changed paths:
M utils/mp-server/update_server
Log Message:
-----------
Merge branch 'master' of https://github.com/wesnoth/wesnoth
Compare: https://github.com/wesnoth/wesnoth/compare/b6ce79e634ca...ae0265fabf95
More information about the Commits
mailing list