diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testplan.cpp | 132 |
1 files changed, 80 insertions, 52 deletions
diff --git a/tests/testplan.cpp b/tests/testplan.cpp index 2e78ec3c9..b567fe5d7 100644 --- a/tests/testplan.cpp +++ b/tests/testplan.cpp @@ -51,11 +51,14 @@ void setupPlan(struct diveplan *dp) struct gasmix ean36 = {{360}, {0}}; struct gasmix oxygen = {{1000}, {0}}; pressure_t po2 = {1600}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 36000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = ean36; - displayed_dive.cylinder[2].gasmix = oxygen; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 36000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = ean36; + cyl2->gasmix = oxygen; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -79,11 +82,14 @@ void setupPlanVpmb45m30mTx(struct diveplan *dp) struct gasmix ean50 = {{500}, {0}}; struct gasmix oxygen = {{1000}, {0}}; pressure_t po2 = {1600}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 24000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = ean50; - displayed_dive.cylinder[2].gasmix = oxygen; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 24000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = ean50; + cyl2->gasmix = oxygen; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -107,11 +113,14 @@ void setupPlanVpmb60m10mTx(struct diveplan *dp) struct gasmix tx50_15 = {{500}, {150}}; struct gasmix oxygen = {{1000}, {0}}; pressure_t po2 = {1600}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 24000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = tx50_15; - displayed_dive.cylinder[2].gasmix = oxygen; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 24000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = tx50_15; + cyl2->gasmix = oxygen; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -130,9 +139,10 @@ void setupPlanVpmb60m30minAir(struct diveplan *dp) dp->decosac = prefs.decosac; struct gasmix bottomgas = {{210}, {0}}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 100000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 100000; + cyl0->type.workingpressure.mbar = 232000; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -152,10 +162,12 @@ void setupPlanVpmb60m30minEan50(struct diveplan *dp) struct gasmix bottomgas = {{210}, {0}}; struct gasmix ean50 = {{500}, {0}}; pressure_t po2 = {1600}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 36000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = ean50; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 36000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = ean50; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -176,10 +188,12 @@ void setupPlanVpmb60m30minTx(struct diveplan *dp) struct gasmix bottomgas = {{180}, {450}}; struct gasmix ean50 = {{500}, {0}}; pressure_t po2 = {1600}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 36000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = ean50; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 36000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = ean50; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -198,9 +212,10 @@ void setupPlanVpmbMultiLevelAir(struct diveplan *dp) dp->decosac = prefs.decosac; struct gasmix bottomgas = {{210}, {0}}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 200000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 200000; + cyl0->type.workingpressure.mbar = 232000; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -223,11 +238,14 @@ void setupPlanVpmb100m60min(struct diveplan *dp) struct gasmix ean50 = {{500}, {0}}; struct gasmix oxygen = {{1000}, {0}}; pressure_t po2 = {1600}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 200000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = ean50; - displayed_dive.cylinder[2].gasmix = oxygen; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 200000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = ean50; + cyl2->gasmix = oxygen; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -250,11 +268,14 @@ void setupPlanVpmb100m10min(struct diveplan *dp) struct gasmix ean50 = {{500}, {0}}; struct gasmix oxygen = {{1000}, {0}}; pressure_t po2 = {1600}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 60000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = ean50; - displayed_dive.cylinder[2].gasmix = oxygen; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 60000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = ean50; + cyl2->gasmix = oxygen; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -274,9 +295,10 @@ void setupPlanVpmb30m20min(struct diveplan *dp) dp->decosac = prefs.decosac; struct gasmix bottomgas = {{210}, {0}}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 36000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 36000; + cyl0->type.workingpressure.mbar = 232000; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -298,12 +320,16 @@ void setupPlanVpmb100mTo70m30min(struct diveplan *dp) struct gasmix ean50 = {{500}, {0}}; struct gasmix oxygen = {{1000}, {0}}; pressure_t po2 = {1600}; - displayed_dive.cylinder[0].gasmix = bottomgas; - displayed_dive.cylinder[0].type.size.mliter = 36000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = tx21_35; - displayed_dive.cylinder[2].gasmix = ean50; - displayed_dive.cylinder[3].gasmix = oxygen; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2); + cylinder_t *cyl3 = get_or_create_cylinder(&displayed_dive, 3); + cyl0->gasmix = bottomgas; + cyl0->type.size.mliter = 36000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = tx21_35; + cyl2->gasmix = ean50; + cyl3->gasmix = oxygen; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); @@ -330,10 +356,12 @@ void setupPlanSeveralGases(struct diveplan *dp) struct gasmix ean36 = {{360}, {0}}; struct gasmix tx11_50 = {{110}, {500}}; - displayed_dive.cylinder[0].gasmix = ean36; - displayed_dive.cylinder[0].type.size.mliter = 36000; - displayed_dive.cylinder[0].type.workingpressure.mbar = 232000; - displayed_dive.cylinder[1].gasmix = tx11_50; + cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0); + cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1); + cyl0->gasmix = ean36; + cyl0->type.size.mliter = 36000; + cyl0->type.workingpressure.mbar = 232000; + cyl1->gasmix = tx11_50; displayed_dive.surface_pressure.mbar = 1013; reset_cylinders(&displayed_dive, true); free_dps(dp); |