test_routing.cc:97 Same expression on both sides of '-'

Bug #975840 reported by Hans Joachim Desserud on 2012-04-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Low
Unassigned

Bug Description

(Found by utils/create_cppcheck_report)

Line 97 in src/economy/test/test_routing.cc has c2.y on both sides of '-'. Compared to the line above, I guess it should be replaced with c1.y - c2.y, but since I don't know what this test does I leave it to someone who knows.

Related branches

Hans Joachim Desserud (hjd) wrote :

I figured I might as well replace the value to make it calculate the Y distance as well. Though after doing this, the test started failing, so it was either done this for a reason or I have uncovered some bug which was hidden.

Test project /home/user/widelands/build
    Start 1: test_economy
1/3 Test #1: test_economy .....................***Failed 0.03 sec
Running 21 test cases...
/home/user/widelands/src/economy/test/test_routing.cc(624): error in "priced_routing": check route.has_chain(chain) failed
lastserial: 0
lastserial: 0
lastserial: 0

*** 1 failure detected in test suite "Economy"

    Start 2: test_io_filesystem
2/3 Test #2: test_io_filesystem ............... Passed 0.01 sec
    Start 3: test_widelands_scripting
3/3 Test #3: test_widelands_scripting ......... Passed 0.01 sec

tags: added: economy
SirVer (sirver) wrote :

Indeed, a bug in the test suite. fixed and merged your branch. Thanks!

Changed in widelands:
status: Triaged → Fix Committed
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers