Commit Graph

10 Commits

Author SHA1 Message Date
Adrian Insaurralde Avalos
667b841de1 [Base] fix some unit tests that where dependent on user config
redundant and faulty test `imperial_decimal_1_mm_default_precision` removed, it is already covered by `imperial_decimal_1_mm_precision_2`
2025-10-14 12:42:24 +02:00
Ladislav Michl
88f76f3605 Base: UnitsSchema: use basic imperial conversion constants
Use well defined basic constants for conversion of imperial units.
This makes code hopefully easily readable and verificable.
2025-09-05 17:31:55 +02:00
Ladislav Michl
913c30429c Base: Quantity: use isDimensionless whenever feasible
Quantity is often queried for Unit just to see if it has a dimension.
Ask Quantity directly using isDimensionless() method and modify that
method not to care about Quantity value validity; no user was ever
asking for value validity.
2025-06-03 09:31:38 +02:00
bofdahof
1155f0d752 Base: simplify UnitsSchemas management
Fixes: Maintaining schemas is difficult and error-prone

- Facilitate easy schemas add, remove, change, etc.
- Remove 14 files containing approx 2,190 lines of if/else code and data
- Place data in one file (UnitsSchemasData.h) using a normalized structure (including special functions)
- Isolate and simplify data operations (code)
- Remove schemas enum to keep data independent of code
- Separate responsibilities: Specifications, data, schemas, schema
- Add schema data 'isDefault'
- Add schema data name
- Prefer algorithms to raw loops
- Add schemas unit tests
- Tweak quantity unit tests
2025-04-27 00:45:54 +02:00
Ladislav Michl
4d6ed9d531 Base: UnitsSchema: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
2ea8a633ac Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
Chris Hennes
11fa271eb5 Test: Support system GTest, and give warning if no submodule (#13662) 2024-06-03 10:40:35 -05:00
Adrián Insaurralde Avalos
9c3ab15ecb Base: escape quotes in Quantity::getSafeUserString
fix #12204 and fix #12206
2024-02-12 12:09:30 -06:00
Chris Hennes
e04bf47d8d Formatting: Apply pre-commit to tests/src 2023-04-06 08:07:53 +02:00
berniev
12fabc104c Multiple files under test in one test file
Put Unit into its own test file and rename Units.cpp to Quantity.cpp
2023-03-02 22:12:21 +01:00