nightscout / Trio

MIT License
46 stars 130 forks source link

Restore tests (replaces PR #147) #206

Closed marionbarker closed 1 month ago

marionbarker commented 1 month ago

There are 2 commits to this PR.

These are notes from @itsmojo:

Regarding having to comment out the 4 tests in CalibrationsTests, the issue seems to be that the expected values are only returned on the first Test run for a given iPhone simulator. After the first run, the values seem to be a consistent values of 0.9500000000000307, 15.999999999996717, 91.99999999999918 & 2 (instead of the 0.8, 37, 101 & 1 in the initial run that are being tested for). So this seems like this is a stateful test which really should be reworked to have consistent results on each run. Also, using XCTAssertTrue() for these tests is not as helpful as using XCTAssertEqual() so that you can see both values on a failure and so an optional accuracy parameter can be used to deal with non exact floating point values like 15.999999999996717.

Note:

The original PR #147 was automatically closed when the Trio repository was made public. This replaces that PR.

avouspierre commented 1 month ago

the testCreateMultipleCalibration fails if you run only this one. testCreateSimpleCalibration and testCreateMulitpleCalibration use the same data so the result of calibration could be different in regard of the order of the execution. Best to launch calibrationService.removeAllCalibrations() at the end of each test to have a clear calibration datasource.

marionbarker commented 1 month ago

Thanks @avouspierre. I believe the last commit makes this a "real" fix. Ready for review.