Bug 1191 - Test does not build: signed-unsigned mismatch
Test does not build: signed-unsigned mismatch
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: test framework
ns-3-dev
All All
: P5 normal
Assigned To: Mitch Watrous
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-16 11:41 UTC by Claudio
Modified: 2011-06-17 16:39 UTC (History)
1 user (show)

See Also:


Attachments
Path with a fix (930 bytes, patch)
2011-06-16 11:41 UTC, Claudio
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Claudio 2011-06-16 11:41:58 UTC
Created attachment 1166 [details]
Path with a fix

Got this while building tests on a pristine checkout (on debian squeeze):

[1037/1351] cxx: src/stats/test/basic-data-calculators-test-suite.cc -> build/optimized/src/stats/test/basic-data-calculators-test-suite_3.o
cc1plus: warnings being treated as errors
../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void OneIntegerTestCase::DoRun()’:
../src/stats/test/basic-data-calculators-test-suite.cc:71: error: comparison between signed and unsigned integer expressions
../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void FiveIntegersTestCase::DoRun()’:
../src/stats/test/basic-data-calculators-test-suite.cc:149: error: comparison between signed and unsigned integer expressions
../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void FiveDoublesTestCase::DoRun()’:
../src/stats/test/basic-data-calculators-test-suite.cc:227: error: comparison between signed and unsigned integer expressions


The attached patch fixes it.
(changing the loop variable to match the type of the limit)
Comment 1 Mitch Watrous 2011-06-16 12:08:22 UTC
Bug closed.

ns-3-dev changeset:  ea18c95c3a9d
Comment 2 Claudio 2011-06-17 06:22:56 UTC
I tried the fix in that changeset before posting the patch, it doesn't work for me at least.

With it, I get:

[1078/1578] cxx: src/stats/test/basic-data-calculators-test-suite.cc -> build/optimized/src/stats/test/basic-data-calculators-test-suite_3.o
cc1plus: warnings being treated as errors
../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void OneIntegerTestCase::DoRun()’:
../src/stats/test/basic-data-calculators-test-suite.cc:96: error: comparison between signed and unsigned integer expressions
../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void FiveIntegersTestCase::DoRun()’:
../src/stats/test/basic-data-calculators-test-suite.cc:174: error: comparison between signed and unsigned integer expressions
../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void FiveDoublesTestCase::DoRun()’:
../src/stats/test/basic-data-calculators-test-suite.cc:252: error: comparison between signed and unsigned integer expressions

And I don't feel comfortable casting the return value of the getters (which would fix that error above). That's why I went for making the loop variable signed.

Cheers.
Comment 3 Claudio 2011-06-17 06:27:17 UTC
Also notice that basic-data-calculators.h clearly states that getCount() returns a long, not a uint32_t.
Comment 4 Mitch Watrous 2011-06-17 11:43:33 UTC
I will do what the patch proposed.
Comment 5 Mitch Watrous 2011-06-17 16:39:08 UTC
Bug closed.

ns-3-dev changeset: b1e882592130