20 Commits

Author SHA1 Message Date
moxian 2ee44002fd Mechanically IWYU the tests
python3 ~/github/include-what-you-use/iwyu_tool.py -j5 -p build $( find
src/ tests/ -maxdepth 1 -name '*.cpp' | grep -v -f
tools/iwyu/bad_files.txt )  --  -Xiwyu --comment_style=long -Xiwyu -
-max_line_length=1000 -Xiwyu --cxx17ns -Xiwyu
--mapping_file=../tools/iwyu/cata.imp   | tee out/iwyu/f-a-01.txt >
/dev/null

followed by

cat out/iwyu/f-a-02.txt | python3
~/github/include-what-you-use/fix_includes.py --reorder --nosafe_headers

followed by manual fixups of <stddef.h> -> <cstddef> and similar.

tests/generic_factory_test.cpp gets mangled very badly (IWYU bug) so
it's excluded from the list.

Code size:
includes:
$ cat obj/tiles/*.inc | wc
 288068  576136 17898260
$ cat tests/obj/tiles/*.inc | wc
 167044  334088 10465766

post-processed source (clang -E):
./make_preproc.sh src/
68567896 177775140 2134075721
./make_preproc.sh tests/
39341957 102891720 1243323710
2025-02-10 00:46:57 -08:00
Zhilkin Serg 3c8ec03bbe Remove thousands separators 2024-11-15 12:09:13 +03:00
Binrui Dong e6d1a7631a Fix int32_t overflow in energy display 2024-02-02 09:43:36 +08:00
Alexey 07356b65a5 Normalize TEST_CASE names (#66241)
* Convert integer parsing test to use normal TEST_CASEs

* Rename test name too similar to another

* Test to enforce normalized test names

* Normalize TEST_CASE names (scripted)
2023-06-17 13:57:19 -03:00
Hirmuolio 042fff658a Add units::temperature_delta (#62452)
Co-authored-by: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
2023-04-25 15:55:38 -07:00
Zhilkin Serg e44f38af40 Remove excessive empty lines 2022-12-06 10:42:15 +03:00
Alexey 43dbd7a5b2 Add units::power (watts) (#62155)
* units::power / watts definition

* Operators between power, energy and time_duration
2022-11-24 06:34:54 -08:00
Drew4484 68af1b9ebe Celcius to Celsius (#61137) 2022-09-20 16:04:40 +03:00
akrieger e97415e789 Convert everything to json_loader from JsonValue::from_* 2022-09-15 22:04:55 -07:00
akrieger 898708829f Fix test compilation 2022-09-15 22:04:54 -07:00
Hirmuolio aaacceb23c Handle item temperature as float (#58172) 2022-06-24 07:30:16 -07:00
akrieger 006c10b379 Convert a bunch of trivial deserialize functions off JsonIn
Most instances of deserialize instantly convert from JsonIn to the
object oriented interface, usually JsonObject. Using the improved
interface on JsonIn we can change the signatures on these to more
accurately reflect what they're doing. Also help get rid of JsonIn
which is not supported in the binary json refactor this unblocks.
2021-09-07 18:08:48 -07:00
John Bytheway ebd549b300 Fix StringMaker ODR violations in tests
Catch2 provides a customization point for converting our types to
strings by specializing the StringMaker template.

We have some specializations in stringmaker.h, but this feature was only
working intermittently.  I finally figured out that was due to an ODR
violation.  The test files that didn't include stringmaker.h were
compiling a different specialization than the ones that did.

Re-jig the test includes so that any file including catch.hpp also
includes stringmaker.h, thereby ensuring that the custom
specializations are used everywhere and there is no ODR violation.

I achieved this by adding a new cata_catch.h header and making all
existing headers include catch.hpp via the new header.
2021-07-03 07:42:06 -07:00
Binrui Dong 9fdb7ef59c Run IWYU
* Change _ctype.h and __locale to cctype and clocale

* Change _wctype.h to cwctype in game.cpp

* Change __functional_base to functional

* Remove libcxx internal headers

* Remove UNIX system headers

* Fix clang-tidy error with -nostdinc++
2021-02-06 00:18:41 -05:00
John Bytheway 2c04d796ef Add units::angle and port various code to use it (#44805)
* Add units::angle and port various code to use it

Add a typesafe angle type.  Partly for general type safety but also to
avoid confusion between different measures of angle (radians, degrees,
and arcmin are all used in this codebase.

Convert tileray to use the new type, and deal with the fallout from
other things that depend on tileray.

Most of the changes relate to changing vehicle facing to the new type.

Note that this changes vehicle facing from an integer to a floating
point type, which could cause some behavioural change.

* Include math_defines.h for Window build
2020-10-18 21:24:56 +00:00
Eric Pierce a8997c21ed Fix unit conversion tests with 1 mm fudge factor 2020-10-05 05:59:55 -06:00
Eric Pierce 1a547d5a06 Test unit-conversion functions
Add tests for:
- convert_length and length_units (tightly coupled)
- convert_volume (to cups, liters, or quarts)
- convert_weight (to kg or lbs)
- convert_velocity (to mph, t/t, km/h, or meters/sec)
2020-09-29 20:22:06 -06:00
Kevin Granade 6d1841ac67 Precompiled Catch2 header (#42453)
* Hoist catch.hpp include to the top of files

* Precompile the catch header in tests
2020-07-29 01:28:26 +03:00
John Bytheway e189957ff2 Run IWYU 20200408 (#39364)
* Helper script to run IWYU

* Run IWYU

* Update deprecated headers

* Run IWYU again

* Re-suppress cxxabi.h

This pragma got accidentally removed because it was deemed to be a
comment attached to a #include.

* Remove extra SDL header includes

* Fix ime.cpp headers

Some tweaks to help IWYU not break this file by messing with
platform-specific stuff not relevant on Linux.

* Update game.h

* Move new point.h includes inside #ifdef

* Re-add platform_win.h to mapsharing.cpp

* Apply suggestions from code review

Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
2020-04-10 12:16:19 +03:00
John Bytheway dd3d5ccc06 Liter literal (#35574)
* Introduce user defined literal for liters

We already had a _ml literal.  Add a _liter literal.  Replace all uses
of _ml which were a whole number of liters with the new literal.

This is the same number of characters, and easier to read (especially
for the really big values; we have a few places with hundreds or
thousands of liters being mentioned).

* Consolidate and expand units unit tests

Remove the separate test files with time and energy tests.  Consolidate
them into one new file units_test.cpp, and add some tests for the other
units-related stuff.
2019-11-18 10:01:36 +03:00