diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 98bd4d7e..d1f311e0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -30,10 +30,10 @@ jobs:
compiler-name-conan: clang
- name: macos-appleclang-11
- os: macos-latest
+ os: macos-10.15
- name: windows-msvc-19
- os: windows-latest
+ os: windows-2019
steps:
- uses: actions/checkout@v2
@@ -48,7 +48,9 @@ jobs:
- name: dependecies (macos)
if: runner.os == 'macOS'
- run: brew install shunit2 ninja conan coreutils
+ run: |
+ brew update
+ brew install shunit2 ninja conan coreutils
- name: dependencies (windows)
if: runner.os == 'Windows'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1960d412..c0a2028b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 2.2.0
+
+* Add `degree_t` to angle type including literals `_deg`
+
## 2.1.3
* Fix CI pipeline for windows
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0dad22d..ca2bce82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
project(
"SI"
- VERSION 2.1.3
+ VERSION 2.2.0
DESCRIPTION
"A header only c++ library that provides type safety and user defined literals for handling pyhsical values defined in the International System of Units."
HOMEPAGE_URL "https://github.com/bernedom/SI"
diff --git a/README.md b/README.md
index 24725ec0..12b49e3d 100644
--- a/README.md
+++ b/README.md
@@ -61,15 +61,16 @@ The typedefs are prefixed (or in rare cases interfixed) with the standard metric
### Special Units
-| Unit | Dimension Symbol | Exponent | Unit Symbol | implemented ratios | unit typedefs |
-| ------------ | ---------------- | -------- | ----------- | ----------------------------------- | ------------------ |
-| Area | L | 2 | m2 | 10-18 to 1018 | `square_*_metre_t` |
-| Volume | L | 3 | m3 | 10-18 to 1018 | `cubic_*_metre_t` |
-| Frequency | T | -1 | Hz | 10-18 to 1018 | `*_hertz_t` |
-| Angle* | r | 1 | rad | 10-18 to 1 | `*_radian_t` |
-| Solid Angle* | R | 1 | sr | 10-18 to 1 | `*_sterradian_t` |
-
-\* Angle and solid angle are simple containers, not containing any functionality to do angle/room-angle computation such as an overflow after 2*pi.
+| Unit | Dimension Symbol | Exponent | Unit Symbol | implemented ratios | unit typedefs |
+| ---------------- | ---------------- | -------- | ----------- | ----------------------------------- | ------------------ |
+| Area | L | 2 | m2 | 10-18 to 1018 | `square_*_metre_t` |
+| Volume | L | 3 | m3 | 10-18 to 1018 | `cubic_*_metre_t` |
+| Frequency | T | -1 | Hz | 10-18 to 1018 | `*_hertz_t` |
+| Angle* | r | 1 | rad | 10-18 to 1 | `*_radian_t` |
+| Angle (Degrees)* | r | 1 | deg | micro, milli, 1 | `*_radian_t` |
+| Solid Angle* | R | 1 | sr | 10-18 to 1 | `*_sterradian_t` |
+
+\* Angle, Angle (degree) and solid angle are simple containers, not containing any functionality to do angle/solid-angle computation such as an overflow after 2*pi. Converting between radians and degree might lose precision, especially if working with `long doubles` because the ratios not precise enough, as they have to be represented as long ints
## Derived units with special names
diff --git a/include/SI/absorbed_dose.h b/include/SI/absorbed_dose.h
index 9a107b00..845c7caf 100644
--- a/include/SI/absorbed_dose.h
+++ b/include/SI/absorbed_dose.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/acceleration.h b/include/SI/acceleration.h
index e9236e5c..ee343884 100644
--- a/include/SI/acceleration.h
+++ b/include/SI/acceleration.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/angle.h b/include/SI/angle.h
index cb127561..f205bde0 100644
--- a/include/SI/angle.h
+++ b/include/SI/angle.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
@@ -28,11 +28,31 @@ template using micro_radian_t = angle_t<_type, std::micro>;
template using milli_radian_t = angle_t<_type, std::milli>;
template using radian_t = angle_t<_type, std::ratio<1>>;
+template
+using micro_degree_t = angle_t<_type, std::ratio<100000000, 5729577951308232>>;
+template
+using milli_degree_t =
+ angle_t<_type, std::ratio<100000000000, 5729577951308232>>;
+template
+using degree_t = angle_t<_type, std::ratio<100000000000000, 5729577951308232>>;
+
// specialize unit_symbol for usage with stream operators
template <>
struct unit_symbol<'r', std::ratio<1>>
: SI::detail::unit_symbol_impl<'r', 'a', 'd'> {};
+template <>
+struct unit_symbol<'r', std::ratio<100000000, 5729577951308232>>
+ : SI::detail::unit_symbol_impl<'u', 'd', 'e', 'g'> {};
+
+template <>
+struct unit_symbol<'r', std::ratio<100000000000, 5729577951308232>>
+ : SI::detail::unit_symbol_impl<'m', 'd', 'e', 'g'> {};
+
+template <>
+struct unit_symbol<'r', std::ratio<100000000000000, 5729577951308232>>
+ : SI::detail::unit_symbol_impl<'d', 'e', 'g'> {};
+
template
struct unit_symbol<'r', _ratio>
: SI::detail::unit_symbol_impl::value, 'r',
@@ -102,6 +122,32 @@ constexpr radian_t operator""_rad(long double value) {
return radian_t{value};
}
+template constexpr micro_degree_t operator""_udeg() {
+ return micro_degree_t{
+ SI::detail::parsing::Number<_digits...>::value};
+}
+
+template constexpr milli_degree_t operator""_mdeg() {
+ return milli_degree_t{
+ SI::detail::parsing::Number<_digits...>::value};
+}
+
+template constexpr degree_t operator""_deg() {
+ return degree_t{SI::detail::parsing::Number<_digits...>::value};
+}
+
+constexpr micro_degree_t operator""_udeg(long double value) {
+ return micro_degree_t{value};
+}
+
+constexpr milli_degree_t operator""_mdeg(long double value) {
+ return milli_degree_t{value};
+}
+
+constexpr degree_t operator""_deg(long double value) {
+ return degree_t{value};
+}
+
} // namespace literals
} // namespace SI
diff --git a/include/SI/area.h b/include/SI/area.h
index 2ec62cb8..1729317d 100644
--- a/include/SI/area.h
+++ b/include/SI/area.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/astronomic.h b/include/SI/astronomic.h
index 14030148..7a163c54 100644
--- a/include/SI/astronomic.h
+++ b/include/SI/astronomic.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/catalytic_activity.h b/include/SI/catalytic_activity.h
index b9b15395..f4f2ada2 100644
--- a/include/SI/catalytic_activity.h
+++ b/include/SI/catalytic_activity.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/detail/cross_unit_operations.h b/include/SI/detail/cross_unit_operations.h
index a5869e1f..a713580d 100644
--- a/include/SI/detail/cross_unit_operations.h
+++ b/include/SI/detail/cross_unit_operations.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/detail/detail.h b/include/SI/detail/detail.h
index 4321898d..0bda7c49 100644
--- a/include/SI/detail/detail.h
+++ b/include/SI/detail/detail.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/detail/eps_equal.h b/include/SI/detail/eps_equal.h
index 9a5fb379..df2cda3b 100644
--- a/include/SI/detail/eps_equal.h
+++ b/include/SI/detail/eps_equal.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
@@ -17,6 +17,7 @@
namespace SI::detail {
+/// @todo make eps_equal take different types with similar properties
template > * = nullptr>
constexpr bool eps_equals(const T &lhs, const T &rhs) {
diff --git a/include/SI/detail/number_parser.h b/include/SI/detail/number_parser.h
index a00c4f2d..59def384 100644
--- a/include/SI/detail/number_parser.h
+++ b/include/SI/detail/number_parser.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/detail/operator_helpers.h b/include/SI/detail/operator_helpers.h
index d88607e3..26a98ba0 100644
--- a/include/SI/detail/operator_helpers.h
+++ b/include/SI/detail/operator_helpers.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/detail/unit.h b/include/SI/detail/unit.h
index 1332356b..295477cc 100644
--- a/include/SI/detail/unit.h
+++ b/include/SI/detail/unit.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/detail/unit_cast.h b/include/SI/detail/unit_cast.h
index 9492c12e..c684935f 100644
--- a/include/SI/detail/unit_cast.h
+++ b/include/SI/detail/unit_cast.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/detail/unit_symbol.h b/include/SI/detail/unit_symbol.h
index 22b4550c..55972e8b 100644
--- a/include/SI/detail/unit_symbol.h
+++ b/include/SI/detail/unit_symbol.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/electric_capacity.h b/include/SI/electric_capacity.h
index 45ed8405..0fd27140 100644
--- a/include/SI/electric_capacity.h
+++ b/include/SI/electric_capacity.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/electric_charge.h b/include/SI/electric_charge.h
index cc008a40..89c3d567 100644
--- a/include/SI/electric_charge.h
+++ b/include/SI/electric_charge.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/electric_conductance.h b/include/SI/electric_conductance.h
index 14563bf5..21d77ed2 100644
--- a/include/SI/electric_conductance.h
+++ b/include/SI/electric_conductance.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/electric_current.h b/include/SI/electric_current.h
index b501b006..7910f1fe 100644
--- a/include/SI/electric_current.h
+++ b/include/SI/electric_current.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/electric_potential.h b/include/SI/electric_potential.h
index 8c24b50a..919674d3 100644
--- a/include/SI/electric_potential.h
+++ b/include/SI/electric_potential.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/electric_resistance.h b/include/SI/electric_resistance.h
index 69bc1af0..e089b183 100644
--- a/include/SI/electric_resistance.h
+++ b/include/SI/electric_resistance.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/energy.h b/include/SI/energy.h
index ab9c9743..7828c504 100644
--- a/include/SI/energy.h
+++ b/include/SI/energy.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/equivalent_dose.h b/include/SI/equivalent_dose.h
index 52e6a35d..85fd7585 100644
--- a/include/SI/equivalent_dose.h
+++ b/include/SI/equivalent_dose.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/force.h b/include/SI/force.h
index 9ba8a634..c4851732 100644
--- a/include/SI/force.h
+++ b/include/SI/force.h
@@ -1,6 +1,6 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/frequency.h b/include/SI/frequency.h
index e5a941d1..3ec4336b 100644
--- a/include/SI/frequency.h
+++ b/include/SI/frequency.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/illuminance.h b/include/SI/illuminance.h
index 8dc71e64..88035ace 100644
--- a/include/SI/illuminance.h
+++ b/include/SI/illuminance.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/inductance.h b/include/SI/inductance.h
index c0d90071..a5bf4571 100644
--- a/include/SI/inductance.h
+++ b/include/SI/inductance.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/length.h b/include/SI/length.h
index 5aacced2..06904d9a 100644
--- a/include/SI/length.h
+++ b/include/SI/length.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/luminosity.h b/include/SI/luminosity.h
index 9759bc07..38714a52 100644
--- a/include/SI/luminosity.h
+++ b/include/SI/luminosity.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/luminous_flux.h b/include/SI/luminous_flux.h
index 6d4fcbed..2e83db65 100644
--- a/include/SI/luminous_flux.h
+++ b/include/SI/luminous_flux.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/magnetic_field.h b/include/SI/magnetic_field.h
index 03ec4a7a..c9d0cfa2 100644
--- a/include/SI/magnetic_field.h
+++ b/include/SI/magnetic_field.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/magnetic_flux.h b/include/SI/magnetic_flux.h
index a3766fef..2f07b7b1 100644
--- a/include/SI/magnetic_flux.h
+++ b/include/SI/magnetic_flux.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/mass.h b/include/SI/mass.h
index f03ef095..0b88b419 100644
--- a/include/SI/mass.h
+++ b/include/SI/mass.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/momentum.h b/include/SI/momentum.h
index 3628ef93..6bad1d45 100644
--- a/include/SI/momentum.h
+++ b/include/SI/momentum.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/power.h b/include/SI/power.h
index c72a0cd6..dbfa2a22 100644
--- a/include/SI/power.h
+++ b/include/SI/power.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/pressure.h b/include/SI/pressure.h
index 3f0c32fd..22bf502f 100644
--- a/include/SI/pressure.h
+++ b/include/SI/pressure.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/radioactivity.h b/include/SI/radioactivity.h
index c627b2f7..1390b342 100644
--- a/include/SI/radioactivity.h
+++ b/include/SI/radioactivity.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/solid_angle.h b/include/SI/solid_angle.h
index fcf4949a..28f00e00 100644
--- a/include/SI/solid_angle.h
+++ b/include/SI/solid_angle.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/stream.h b/include/SI/stream.h
index f8df3020..25b200de 100644
--- a/include/SI/stream.h
+++ b/include/SI/stream.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/substance.h b/include/SI/substance.h
index f3df3434..8cb8f77e 100644
--- a/include/SI/substance.h
+++ b/include/SI/substance.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/temperature.h b/include/SI/temperature.h
index f99d1bd5..c2f8930c 100644
--- a/include/SI/temperature.h
+++ b/include/SI/temperature.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/time.h b/include/SI/time.h
index 92924b8b..ca80ffd0 100644
--- a/include/SI/time.h
+++ b/include/SI/time.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/include/SI/velocity.h b/include/SI/velocity.h
index 8609ad53..f3363536 100644
--- a/include/SI/velocity.h
+++ b/include/SI/velocity.h
@@ -1,5 +1,5 @@
/**
- * This file is part of "SI" version 2.1.3
+ * This file is part of "SI" version 2.2.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
diff --git a/test/src/derived_unit_tests/angle_tests.cc b/test/src/derived_unit_tests/angle_tests.cc
index e0a18faa..3294d831 100644
--- a/test/src/derived_unit_tests/angle_tests.cc
+++ b/test/src/derived_unit_tests/angle_tests.cc
@@ -1,12 +1,14 @@
#include
#include
+#include
#include
+#include
#include
using namespace SI::literals;
TEST_CASE("GIVEN a value WHEN constructed with literal _arad THEN result is a "
- "angle type AND ratio 1 to 10^15") {
+ "angle type AND ratio 1 to 10^18") {
constexpr auto one = 1_arad;
STATIC_REQUIRE(std::is_same>::value);
@@ -230,3 +232,147 @@ TEST_CASE("GIVEN a string of '1rad' WHEN streamed into radian_t THEN result "
REQUIRE(value == 1_rad);
}
+TEST_CASE("GIVEN a value WHEN constructed with literal _udeg THEN result is a "
+ "angle type AND ratio 1 to 10^6") {
+ constexpr auto one = 1_udeg;
+ STATIC_REQUIRE(
+ std::is_same<
+ decltype(one),
+ const SI::angle_t>>::value);
+
+ constexpr auto one_f = 1.0_udeg;
+ STATIC_REQUIRE(
+ std::is_same<
+ decltype(one_f),
+ const SI::angle_t>>::value);
+}
+
+TEST_CASE("GIVEN a value WHEN constructed with literal _mdeg THEN result is a "
+ "angle type AND ratio 1 to 1000") {
+ constexpr auto one = 1_mdeg;
+ STATIC_REQUIRE(
+ std::is_same<
+ decltype(one),
+ const SI::angle_t<
+ int64_t, std::ratio<100000000000, 5729577951308232>>>::value);
+
+ constexpr auto one_f = 1.0_mdeg;
+ STATIC_REQUIRE(
+ std::is_same<
+ decltype(one_f),
+ const SI::angle_t<
+ long double, std::ratio<100000000000, 5729577951308232>>>::value);
+}
+
+TEST_CASE("GIVEN a value WHEN constructed with literal _deg THEN result is a "
+ "angle type AND ratio 1 to 1") {
+ constexpr auto one = 1_deg;
+ STATIC_REQUIRE(
+ std::is_same<
+ decltype(one),
+ const SI::angle_t<
+ int64_t, std::ratio<100000000000000, 5729577951308232>>>::value);
+
+ constexpr auto one_f = 1.0_deg;
+ STATIC_REQUIRE(
+ std::is_same<
+ decltype(one_f),
+ const SI::angle_t>>::value);
+}
+
+TEST_CASE("GIVEN a 1 micro degree WHEN passed to a streaming operator THEN "
+ "result is '1udeg'") {
+ constexpr auto value = 1_udeg;
+ std::stringstream ss;
+ ss << value;
+ REQUIRE(ss.str() == SI::to_string(value));
+ REQUIRE(ss.str() == "1udeg");
+}
+
+TEST_CASE("GIVEN a 1 milli degree WHEN passed to a streaming operator THEN "
+ "result is '1mdeg'") {
+ constexpr auto value = 1_mdeg;
+ std::stringstream ss;
+ ss << value;
+ REQUIRE(ss.str() == SI::to_string(value));
+ REQUIRE(ss.str() == "1mdeg");
+}
+
+TEST_CASE("GIVEN a 1 degree WHEN passed to a streaming operator THEN result is "
+ "'1deg'") {
+ constexpr auto value = 1_deg;
+ std::stringstream ss;
+ ss << value;
+ REQUIRE(ss.str() == SI::to_string(value));
+ REQUIRE(ss.str() == "1deg");
+}
+
+TEST_CASE(
+ "GIVEN a string of '1udeg' WHEN streamed into micro_degree_t THEN result "
+ "is a value of 1 micro_degree_t AND stream is good") {
+ std::stringstream ss;
+ ss << "1udeg";
+ SI::micro_degree_t value{0};
+ ss >> value;
+ REQUIRE(!ss.fail());
+ REQUIRE(value == 1_udeg);
+}
+
+TEST_CASE(
+ "GIVEN a string of '1mdeg' WHEN streamed into milli_degree_t THEN result "
+ "is a value of 1 milli_degree_t AND stream is good") {
+ std::stringstream ss;
+ ss << "1mdeg";
+ SI::milli_degree_t value{0};
+ ss >> value;
+ REQUIRE(!ss.fail());
+ REQUIRE(value == 1_mdeg);
+}
+
+TEST_CASE("GIVEN a string of '1deg' WHEN streamed into degree_t THEN result "
+ "is a value of 1 degree_t AND stream is good") {
+ std::stringstream ss;
+ ss << "1deg";
+ SI::degree_t value{0};
+ ss >> value;
+ REQUIRE(!ss.fail());
+ REQUIRE(value == 1_deg);
+}
+
+TEST_CASE("GIVEN a value of 1.0 rad WHEN converted to degrees THEN result is "
+ "57.29577951308232") {
+
+ constexpr auto value = 1.0_rad;
+ constexpr SI::degree_t deg = value;
+
+ REQUIRE(SI::detail::eps_equals(deg.value(), 57.29577951308232L));
+}
+
+TEST_CASE("GIVEN a value of 1.0 mrad WHEN converted to mdegrees THEN result is "
+ "57.29577951308232") {
+
+ constexpr auto value = 1.0_mrad;
+ constexpr SI::milli_degree_t deg = value;
+
+ REQUIRE(SI::detail::eps_equals(deg.value(), 57.29577951308232L));
+}
+
+TEST_CASE("GIVEN a value of 1.0 urad WHEN converted to udegrees THEN result is "
+ "57.29577951308232") {
+
+ constexpr auto value = 1.0_urad;
+ constexpr SI::micro_degree_t deg = value;
+
+ REQUIRE(SI::detail::eps_equals(deg.value(), 57.29577951308232L));
+}
+
+TEST_CASE(
+ "GIVEN a value of 180.0 def WHEN converted to radian THEN result is PI") {
+ constexpr auto value = 180.0_deg;
+ constexpr SI::radian_t rad = value;
+
+ REQUIRE(SI::detail::eps_equals(rad.value(), 3.14159265358979328643L));
+}
\ No newline at end of file