use crate::system::constants::{LN_2, LN_10, PI, TAU};
use crate::system::prefixes::*;
use crate::{quantity, unit};
use typenum::*;
quantity!(Dimensionless: M Z0, L Z0, T Z0, I Z0, Th Z0, N Z0, J Z0); unit!(base: One, "1", Dimensionless);
unit!(derived: Percent, "%", (0.01, One));
unit!(derived: Permille, "‰", (0.001, One));
unit!(derived: PartsPerMillion, "ppm", (1e-6, One));
unit!(derived: PartsPerBillion, "ppb", (1e-9, One));
quantity!(Angle: M Z0, L Z0, T Z0, I Z0, Th Z0, N Z0, J Z0; marked); unit!(base: Radian, "rad", Angle);
unit!(derived: Degree, "°", (PI / 180.0, Radian));
unit!(derived: Gradian, "gon", (PI / 200.0, Radian));
unit!(derived: Turn, "tr", (TAU, Radian));
unit!(derived: Arcminute, "arcmin", (PI / 10800.0, Radian));
unit!(derived: Arcsecond, "arcsec", (1.0 / 60.0, Arcminute));
quantity!(SolidAngle: M Z0, L Z0, T Z0, I Z0, Th Z0, N Z0, J Z0; marked); unit!(compound: Steradian, "sr", [(Radian, P2)]; marked SolidAngle);
quantity!(LogarithmicRatio: M Z0, L Z0, T Z0, I Z0, Th Z0, N Z0, J Z0; marked); unit!(base: Neper, "Np", LogarithmicRatio);
unit!(derived: Octave, "oct", (LN_2, Neper));
unit!(derived: Bel, "B", (LN_10, Neper));
unit!(prefix: Decibel, Deci, Bel);
#[cfg(test)]
mod tests {
use super::*;
use crate::common::verify_unit;
verify_unit!(One, Dimensionless, 1.0);
verify_unit!(Percent, Dimensionless, 0.01);
verify_unit!(Permille, Dimensionless, 0.001);
verify_unit!(PartsPerMillion, Dimensionless, 1e-6);
verify_unit!(PartsPerBillion, Dimensionless, 1e-9);
verify_unit!(Radian, Angle, 1.0);
verify_unit!(Degree, Angle, 0.017453292519943295);
verify_unit!(Gradian, Angle, 0.015707963267948967);
verify_unit!(Turn, Angle, TAU);
verify_unit!(Arcminute, Angle, 0.0002908882086657216);
verify_unit!(Arcsecond, Angle, 4.84813681109536e-6);
verify_unit!(Steradian, SolidAngle, 1.0);
verify_unit!(Neper, LogarithmicRatio, 1.0);
verify_unit!(Octave, LogarithmicRatio, LN_2);
verify_unit!(Bel, LogarithmicRatio, LN_10);
verify_unit!(Decibel, LogarithmicRatio, 0.23025850929940457);
}