mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[poincare] Add comment on unit tests
This commit is contained in:
@@ -85,15 +85,18 @@ void assert_seconds_split_to(double totalSeconds, const char * splittedTime, Con
|
||||
QUIZ_CASE(poincare_expression_unit_constructor) {
|
||||
Shared::GlobalContext globalContext;
|
||||
ExpressionNode::ReductionContext reductionContext = ExpressionNode::ReductionContext(&globalContext, Cartesian, Degree, User);
|
||||
// Time
|
||||
// 1. Time
|
||||
// 1.a. Test Unit::Second constructor
|
||||
Unit s = Unit::Second();
|
||||
// 1.b. Test Unit::isSecond helper
|
||||
quiz_assert(s.isSecond());
|
||||
quiz_assert(!s.isMeter());
|
||||
|
||||
// 1.c. Test Unit::BuildTimeSplit constructor
|
||||
assert_seconds_split_to(1234567890, "39×_year+1×_month+13×_day+19×_h+1×_min+30×_s", &globalContext, Cartesian, Degree);
|
||||
assert_seconds_split_to(-122, "-2×_min-2×_s", &globalContext, Cartesian, Degree);
|
||||
|
||||
// Speed
|
||||
// 2. Speed
|
||||
// 2.a. test Unit::Kilometer and Unit::Hour constructors
|
||||
Expression kilometerPerHour = Multiplication::Builder(
|
||||
Unit::Kilometer(),
|
||||
Power::Builder(
|
||||
@@ -104,16 +107,20 @@ QUIZ_CASE(poincare_expression_unit_constructor) {
|
||||
kilometerPerHour = kilometerPerHour.reduce(reductionContext);
|
||||
Expression meterPerSecond;
|
||||
kilometerPerHour = kilometerPerHour.removeUnit(&meterPerSecond);
|
||||
// 2.b. Test Unit::IsISSpeed helper
|
||||
quiz_assert(Unit::IsISSpeed(meterPerSecond));
|
||||
|
||||
// Volume
|
||||
// 3. Volume
|
||||
// 3.a. test Unit::Liter constructor
|
||||
Expression liter = Unit::Liter();
|
||||
liter = liter.reduce(reductionContext);
|
||||
Expression meter3;
|
||||
liter = liter.removeUnit(&meter3);
|
||||
// 3.b. Test Unit::IsISVolume helper
|
||||
quiz_assert(Unit::IsISVolume(meter3));
|
||||
|
||||
// Energy
|
||||
// 4. Energy
|
||||
// 4.a. test Unit::Watt and Unit::Hour constructors
|
||||
Expression wattHour = Multiplication::Builder(
|
||||
Unit::Watt(),
|
||||
Unit::Hour()
|
||||
@@ -121,5 +128,6 @@ QUIZ_CASE(poincare_expression_unit_constructor) {
|
||||
wattHour = wattHour.reduce(reductionContext);
|
||||
Expression kilogramMeter2PerSecond2;
|
||||
wattHour = wattHour.removeUnit(&kilogramMeter2PerSecond2);
|
||||
// 4.b. Test Unit::IsISEnergy helper
|
||||
quiz_assert(Unit::IsISEnergy(kilogramMeter2PerSecond2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user