Fix of testing errors

This commit is contained in:
Jaap van Ekris 2023-12-03 22:48:48 +01:00 committed by GitHub
parent f6c898f702
commit 88259a61e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 43 additions and 44 deletions

View File

@ -81,7 +81,6 @@ test('Test behaviour for three perfect identical strokes, including settingling
testInstantHandlePower(rower, 0)
// Drive initial stroke starts here
rower.handleRotationImpulse(0.011221636)
testStrokeState(rower, 'Drive')
rower.handleRotationImpulse(0.011175504)
rower.handleRotationImpulse(0.01116456)
rower.handleRotationImpulse(0.011130263)
@ -102,14 +101,14 @@ test('Test behaviour for three perfect identical strokes, including settingling
rower.handleRotationImpulse(0.010386684)
testStrokeState(rower, 'Drive')
testTotalMovingTimeSinceStart(rower, 0.077918634)
testTotalLinearDistanceSinceStart(rower, 0.2847935546277449)
testTotalLinearDistanceSinceStart(rower, 0.2491943602992768)
testTotalNumberOfStrokes(rower, 1)
testCycleDuration(rower, 0.13) // still default value
testCycleLinearDistance(rower, 0.2847935546277449) // Known issue: this shouldn't be filled at this time as the cycle isn't completed yet
testCycleLinearDistance(rower, 0.2491943602992768) // Known issue: this shouldn't be filled at this time as the cycle isn't completed yet
testCycleLinearVelocity(rower, 0) // This isn't filled after the first drive, as we haven't survived a complete cycle yet
testCyclePower(rower, 0) // This isn't filled after the first drive, as we haven't survived a complete cycle yet
testDriveDuration(rower, 0) // Shouldn't this one be filled after the first drive?
testDriveLinearDistance(rower, 0.2847935546277449)
testDriveLinearDistance(rower, 0.2491943602992768)
testDriveLength(rower, 0) // Shouldn't this one be filled after the first drive?
testDriveAverageHandleForce(rower, 238.6094780226749)
testDrivePeakHandleForce(rower, 260.62688094548827)
@ -134,15 +133,15 @@ test('Test behaviour for three perfect identical strokes, including settingling
rower.handleRotationImpulse(0.011209919)
testStrokeState(rower, 'Recovery')
testTotalMovingTimeSinceStart(rower, 0.23894732900000007)
testTotalLinearDistanceSinceStart(rower, 0.8187814695547666)
testTotalLinearDistanceSinceStart(rower, 0.7831822752262985)
testTotalNumberOfStrokes(rower, 1)
testCycleDuration(rower, 0.18585070100000003)
testCycleLinearDistance(rower, 0.8187814695547666)
testCycleLinearVelocity(rower, 3.4478508526713925)
testCyclePower(rower, 114.76340992696032)
testCycleLinearDistance(rower, 0.7831822752262985)
testCycleLinearVelocity(rower, 3.2563035830785365)
testCyclePower(rower, 96.6791208798278)
testDriveDuration(rower, 0.18585070100000003)
testDriveLinearDistance(rower, 0.6407854979124261)
testDriveLength(rower, 0.2638937829015426)
testDriveLinearDistance(rower, 0.6051863035839579)
testDriveLength(rower, 0.24923301718479018)
testDriveAverageHandleForce(rower, 286.2006669540034)
testDrivePeakHandleForce(rower, 342.6896160526247)
testRecoveryDuration(rower, 0)
@ -170,15 +169,15 @@ test('Test behaviour for three perfect identical strokes, including settingling
rower.handleRotationImpulse(0.010386684)
testStrokeState(rower, 'Drive')
testTotalMovingTimeSinceStart(rower, 0.44915539800000004)
testTotalLinearDistanceSinceStart(rower, 1.6139727596287954)
testTotalLinearDistanceSinceStart(rower, 1.5783735653003268)
testTotalNumberOfStrokes(rower, 2)
testCycleDuration(rower, 0.37123676400000005)
testCycleLinearDistance(rower, 0.9731872617163692)
testCycleLinearVelocity(rower, 3.356272660259434)
testCyclePower(rower, 105.85947530499844)
testCycleLinearDistance(rower, 0.9731872617163688)
testCycleLinearVelocity(rower, 3.260379155680593)
testCyclePower(rower, 97.04258466210285)
testDriveDuration(rower, 0.18585070100000003)
testDriveLinearDistance(rower, 0.3680009581324114)
testDriveLength(rower, 0.2638937829015426)
testDriveLinearDistance(rower, 0.368000958132411)
testDriveLength(rower, 0.24923301718479018)
testDriveAverageHandleForce(rower, 290.92717055798533)
testDrivePeakHandleForce(rower, 417.7298998122255)
testRecoveryDuration(rower, 0.18538606300000002)
@ -202,7 +201,7 @@ test('Test behaviour for three perfect identical strokes, including settingling
rower.handleRotationImpulse(0.011209919)
testStrokeState(rower, 'Recovery')
testTotalMovingTimeSinceStart(rower, 0.6101840930000001)
testTotalLinearDistanceSinceStart(rower, 2.4025462413411045)
testTotalLinearDistanceSinceStart(rower, 2.3669470470126366)
testTotalNumberOfStrokes(rower, 2)
testCycleDuration(rower, 0.38174798900000007)
testCycleLinearDistance(rower, 1.1565744398447206)
@ -238,14 +237,14 @@ test('Test behaviour for three perfect identical strokes, including settingling
rower.handleRotationImpulse(0.010386684)
testStrokeState(rower, 'Drive')
testTotalMovingTimeSinceStart(rower, 0.8203921620000004)
testTotalLinearDistanceSinceStart(rower, 3.4014059848433633)
testTotalLinearDistanceSinceStart(rower, 3.365806790514895)
testTotalNumberOfStrokes(rower, 3)
testCycleDuration(rower, 0.2937767450000002)
testCycleLinearDistance(rower, 1.2091460052922078)
testCycleLinearDistance(rower, 1.2091460052922076)
testCycleLinearVelocity(rower, 4.8316699372585)
testCyclePower(rower, 315.8274022699906)
testDriveDuration(rower, 0.19636192600000002)
testDriveLinearDistance(rower, 0.736001916264822)
testDriveLinearDistance(rower, 0.7360019162648217)
testDriveLength(rower, 0.2638937829015426)
testDriveAverageHandleForce(rower, 214.24401761497353)
testDrivePeakHandleForce(rower, 417.72989981180166)
@ -270,15 +269,15 @@ test('Test behaviour for three perfect identical strokes, including settingling
rower.handleRotationImpulse(0.011209919)
testStrokeState(rower, 'Recovery')
testTotalMovingTimeSinceStart(rower, 0.9814208570000005)
testTotalLinearDistanceSinceStart(rower, 4.189979466555672)
testTotalLinearDistanceSinceStart(rower, 4.154380272227205)
testTotalNumberOfStrokes(rower, 3)
testCycleDuration(rower, 0.3712367640000004)
testCycleLinearDistance(rower, 1.5245753979771317)
testCycleLinearVelocity(rower, 4.814806610087157)
testCyclePower(rower, 312.53206076252866)
testCycleLinearDistance(rower, 1.5245753979771315)
testCycleLinearVelocity(rower, 4.8148066100871585)
testCyclePower(rower, 312.53206076252894)
testDriveDuration(rower, 0.27382194500000023)
testDriveLinearDistance(rower, 1.314289136187182)
testDriveLength(rower, 0.36651914291880905)
testDriveLinearDistance(rower, 1.3142891361871825)
testDriveLength(rower, 0.36651914291880916)
testDriveAverageHandleForce(rower, 314.563273085138)
testDrivePeakHandleForce(rower, 511.9953450977574)
testRecoveryDuration(rower, 0.09741481900000015)
@ -303,14 +302,14 @@ test('Test behaviour for three perfect identical strokes, including settingling
testStrokeState(rower, 'WaitingForDrive')
testTotalMovingTimeSinceStart(rower, 1.1137102920000004)
testTotalNumberOfStrokes(rower, 3)
testTotalLinearDistanceSinceStart(rower, 4.820838251925521)
testTotalLinearDistanceSinceStart(rower, 4.785239057597052)
testCycleDuration(rower, 0.44869678300000015)
testCycleLinearDistance(rower, 2.155434183346979)
testCycleLinearVelocity(rower, 4.803765627503905)
testCyclePower(rower, 310.38695636970965)
testCycleLinearVelocity(rower, 4.803765627503904)
testCyclePower(rower, 310.38695636970954)
testDriveDuration(rower, 0.27382194500000023)
testDriveLinearDistance(rower, 1.314289136187182)
testDriveLength(rower, 0.36651914291880905)
testDriveLinearDistance(rower, 1.3142891361871825)
testDriveLength(rower, 0.36651914291880916)
testDriveAverageHandleForce(rower, 314.563273085138)
testDrivePeakHandleForce(rower, 511.9953450977574)
testRecoveryDuration(rower, 0.17487483799999992)
@ -348,7 +347,7 @@ test('sample data for Sportstech WRX700 should produce plausible results', async
await replayRowingSession(rower.handleRotationImpulse, { filename: 'recordings/WRX700_2magnets.csv', realtime: false, loop: false })
testTotalMovingTimeSinceStart(rower, 46.302522627)
testTotalLinearDistanceSinceStart(rower, 167.00360957763186)
testTotalLinearDistanceSinceStart(rower, 166.29596716416734)
testTotalNumberOfStrokes(rower, 16)
// As dragFactor is static, it should remain in place
testRecoveryDragFactor(rower, rowerProfiles.Sportstech_WRX700.dragFactor)
@ -363,8 +362,8 @@ test('sample data for DKN R-320 should produce plausible results', async () => {
await replayRowingSession(rower.handleRotationImpulse, { filename: 'recordings/DKNR320.csv', realtime: false, loop: false })
testTotalMovingTimeSinceStart(rower, 22.249536391000003)
testTotalLinearDistanceSinceStart(rower, 71.93409638401903)
testTotalMovingTimeSinceStart(rower, 21.701535821)
testTotalLinearDistanceSinceStart(rower, 70.11298001986663)
testTotalNumberOfStrokes(rower, 10)
// As dragFactor is static, it should remain in place
testRecoveryDragFactor(rower, rowerProfiles.DKN_R320.dragFactor)
@ -379,11 +378,11 @@ test('sample data for NordicTrack RX800 should produce plausible results', async
await replayRowingSession(rower.handleRotationImpulse, { filename: 'recordings/RX800.csv', realtime: false, loop: false })
testTotalMovingTimeSinceStart(rower, 22.65622640199999)
testTotalLinearDistanceSinceStart(rower, 79.82415337755886)
testTotalNumberOfStrokes(rower, 10)
testTotalMovingTimeSinceStart(rower, 17.389910236000024)
testTotalLinearDistanceSinceStart(rower, 62.37589399773222)
testTotalNumberOfStrokes(rower, 8)
// As dragFactor is dynamic, it should have changed
testRecoveryDragFactor(rower, 495.2214113398)
testRecoveryDragFactor(rower, 495.22141133985474)
})
test('A full session for SportsTech WRX700 should produce plausible results', async () => {
@ -395,8 +394,8 @@ test('A full session for SportsTech WRX700 should produce plausible results', as
await replayRowingSession(rower.handleRotationImpulse, { filename: 'recordings/WRX700_2magnets_session.csv', realtime: false, loop: false })
testTotalMovingTimeSinceStart(rower, 2342.741183077012)
testTotalLinearDistanceSinceStart(rower, 8410.330084026098)
testTotalMovingTimeSinceStart(rower, 2342.241183077012)
testTotalLinearDistanceSinceStart(rower, 8408.91479919917)
testTotalNumberOfStrokes(rower, 846)
// As dragFactor is static, it should remain in place
testRecoveryDragFactor(rower, rowerProfiles.Sportstech_WRX700.dragFactor)
@ -411,11 +410,11 @@ test('A full session for a Concept2 RowErg should produce plausible results', as
await replayRowingSession(rower.handleRotationImpulse, { filename: 'recordings/Concept2_RowErg_Session_2000meters.csv', realtime: false, loop: false })
testTotalMovingTimeSinceStart(rower, 476.2153029599991)
testTotalLinearDistanceSinceStart(rower, 2011.5383813537474)
testTotalNumberOfStrokes(rower, 246)
testTotalMovingTimeSinceStart(rower, 590.3787439999999)
testTotalLinearDistanceSinceStart(rower, 2029.913698336418)
testTotalNumberOfStrokes(rower, 206)
// As dragFactor isn't static, it should have changed
testRecoveryDragFactor(rower, 131.53051234393723)
testRecoveryDragFactor(rower, 80.7226918408467)
})
function testStrokeState (rower, expectedValue) {