Add another test for formatDiveGasString

This adds a test for the bug just fixed, where we have a trimix gas and
nitrox/air with less o2 than the trimix.

Signed-off-by: Anton Lundin <glance@ac2.se>
This commit is contained in:
Anton Lundin 2023-10-18 07:32:36 +02:00 committed by Michael Keller
parent 94164bb8fa
commit 8d3f2e4ca6
2 changed files with 28 additions and 0 deletions

View file

@ -208,4 +208,31 @@ void TestformatDiveGasString::test_ccr() {
QCOMPARE(formatDiveGasString(&dive), "21/35"); QCOMPARE(formatDiveGasString(&dive), "21/35");
} }
void TestformatDiveGasString::test_ccr_bailout() {
struct dive dive = {0};
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
cylinder->gasmix.o2.permille = 1000;
cylinder->cylinder_use = OXYGEN;
cylinder->start.mbar = 230000;
cylinder->end.mbar = 100000;
cylinder = get_or_create_cylinder(&dive, 1);
cylinder->gasmix.o2.permille = 220;
cylinder->gasmix.he.permille = 200;
cylinder->cylinder_use = DILUENT;
cylinder->start.mbar = 230000;
cylinder->end.mbar = 100000;
cylinder = get_or_create_cylinder(&dive, 2);
cylinder->gasmix.o2.permille = 210;
cylinder->gasmix.he.permille = 0;
cylinder->start.mbar = 230000;
cylinder->end.mbar = 100000;
QCOMPARE(formatDiveGasString(&dive), "22/20");
}
QTEST_GUILESS_MAIN(TestformatDiveGasString) QTEST_GUILESS_MAIN(TestformatDiveGasString)

View file

@ -18,4 +18,5 @@ private slots:
void test_trimix_and_nitrox_same_o2(); void test_trimix_and_nitrox_same_o2();
void test_trimix_and_nitrox_lower_o2(); void test_trimix_and_nitrox_lower_o2();
void test_ccr(); void test_ccr();
void test_ccr_bailout();
}; };