Commit Graph

4 Commits

Author SHA1 Message Date
Florian Weimer 2b3aa44656 support: Increase usability of TEST_COMPARE
The previous implementation of the TEST_COMPARE macro would fail
to compile code like this:

  int ret = res_send (query, sizeof (query), buf, sizeof (buf));
  TEST_COMPARE (ret,
                sizeof (query)
                + 2             /* Compression reference.  */
                + 2 + 2 + 4 + 2 /* Type, class, TTL, RDATA length.  */
                + 1             /* Pascal-style string length.  */
                + strlen (expected_name));

This resulted in a failed static assertion, "integer conversions
may alter sign of operands".  A user of the TEST_COMPARE would have
to add a cast to fix this.

This patch reverts to the original proposed solution of a run-time
check, making TEST_COMPARE usable for comparisons of numbers with
types with different signedness in more contexts.
2018-01-08 20:07:24 +01:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Florian Weimer da616c1496 support/tst-test_compare: Fix 32-bit/64-bit expected output mismatch
The use of a long type resulted in test output differences between
32-bit and 64-bit architectures, causing the test to fail on 32-bit
architectures.
2017-12-05 15:08:59 +01:00
Florian Weimer 934855246d support: Add TEST_COMPARE macro 2017-12-04 20:56:08 +01:00