Thanks to visit codestin.com
Credit goes to github.com

Skip to content

format-test fails 3 tests under GCC with -std=c++11 rather than -std=gnu++11 #1787

@tonyelewis

Description

@tonyelewis

Building and running format-test on Ubuntu 20.04 with:

rm -rf build
mkdir build
cmake -GNinja -Bbuild -H. -DCMAKE_CXX_EXTENSIONS=OFF
ninja -C build format-test
build/bin/format-test

…I get three failures:

[...]

[ RUN      ] FormatterTest.FormatBin
[       OK ] FormatterTest.FormatBin (0 ms)
[ RUN      ] FormatterTest.FormatDec
../test/format-test.cc:1124: Failure
Value of: format("{0}", static_cast<__int128_t>((9223372036854775807L)) + 1)
  Actual: "0"
Expected: "9223372036854775808"
../test/format-test.cc:1126: Failure
Value of: format("{0}", static_cast<__int128_t>((-9223372036854775807L-1)) - 1)
  Actual: "4294967295"
Expected: "-9223372036854775809"
../test/format-test.cc:1128: Failure
Value of: format("{0}", static_cast<__int128_t>((18446744073709551615UL)) + 1)
  Actual: "0"
Expected: "18446744073709551616"
../test/format-test.cc:1130: Failure
Value of: format("{0}", int128_max)
  Actual: "4294967295"
Expected: "170141183460469231731687303715884105727"
../test/format-test.cc:1132: Failure
Value of: format("{0}", int128_min)
  Actual: "0"
Expected: "-170141183460469231731687303715884105728"
../test/format-test.cc:1134: Failure
Value of: format("{0}", uint128_max)
  Actual: "4294967295"
Expected: "340282366920938463463374607431768211455"
[  FAILED  ] FormatterTest.FormatDec (0 ms)
[ RUN      ] FormatterTest.FormatHex
../test/format-test.cc:1165: Failure
Value of: format("{0:x}", static_cast<__int128_t>((9223372036854775807L)) + 1)
  Actual: "0"
Expected: "8000000000000000"
../test/format-test.cc:1167: Failure
Value of: format("{0:x}", static_cast<__int128_t>((-9223372036854775807L-1)) - 1)
  Actual: "ffffffff"
Expected: "-8000000000000001"
../test/format-test.cc:1169: Failure
Value of: format("{0:x}", static_cast<__int128_t>((18446744073709551615UL)) + 1)
  Actual: "0"
Expected: "10000000000000000"
../test/format-test.cc:1171: Failure
Value of: format("{0:x}", int128_max)
  Actual: "ffffffff"
Expected: "7fffffffffffffffffffffffffffffff"
../test/format-test.cc:1172: Failure
Value of: format("{0:x}", int128_min)
  Actual: "0"
Expected: "-80000000000000000000000000000000"
../test/format-test.cc:1173: Failure
Value of: format("{0:x}", uint128_max)
  Actual: "ffffffff"
Expected: "ffffffffffffffffffffffffffffffff"
[  FAILED  ] FormatterTest.FormatHex (0 ms)
[ RUN      ] FormatterTest.FormatOct
../test/format-test.cc:1200: Failure
Value of: format("{0:o}", static_cast<__int128_t>((9223372036854775807L)) + 1)
  Actual: "0"
Expected: "1000000000000000000000"
../test/format-test.cc:1202: Failure
Value of: format("{0:o}", static_cast<__int128_t>((-9223372036854775807L-1)) - 1)
  Actual: "37777777777"
Expected: "-1000000000000000000001"
../test/format-test.cc:1204: Failure
Value of: format("{0:o}", static_cast<__int128_t>((18446744073709551615UL)) + 1)
  Actual: "0"
Expected: "2000000000000000000000"
../test/format-test.cc:1206: Failure
Value of: format("{0:o}", int128_max)
  Actual: "37777777777"
Expected: "1777777777777777777777777777777777777777777"
../test/format-test.cc:1208: Failure
Value of: format("{0:o}", int128_min)
  Actual: "0"
Expected: "-2000000000000000000000000000000000000000000"
../test/format-test.cc:1210: Failure
Value of: format("{0:o}", uint128_max)
  Actual: "37777777777"
Expected: "3777777777777777777777777777777777777777777"
[  FAILED  ] FormatterTest.FormatOct (0 ms)
[ RUN      ] FormatterTest.FormatIntLocale
[       OK ] FormatterTest.FormatIntLocale (0 ms)

[...]

[----------] Global test environment tear-down
[==========] 114 tests from 12 test cases ran. (14 ms total)
[  PASSED  ] 111 tests.
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] FormatterTest.FormatDec
[  FAILED  ] FormatterTest.FormatHex
[  FAILED  ] FormatterTest.FormatOct

 3 FAILED TESTS

I think this is cause by the -DCMAKE_CXX_EXTENSIONS=OFF making the compilation command use -std=c++11 rather than -std=gnu++11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions