Make plan take dive and decotimestep as arguments

...rather than use a global variable and a macro.

This should be a no-op in preparation to allow planning
several versions of a dive.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2017-08-23 22:43:33 +02:00 committed by Dirk Hohndel
parent 58d7948871
commit 82aac4efff
4 changed files with 73 additions and 71 deletions

View file

@ -10,7 +10,7 @@
#define DEBUG 1
// testing the dive plan algorithm
extern bool plan(struct diveplan *diveplan, struct deco_state **cached_datap, bool is_planner, bool show_disclaimer);
extern bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct deco_state **cached_datap, bool is_planner, bool show_disclaimer);
extern pressure_t first_ceiling_pressure;
@ -364,7 +364,7 @@ void TestPlan::testMetric()
struct diveplan testPlan = {};
setupPlan(&testPlan);
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -404,7 +404,7 @@ void TestPlan::testImperial()
struct diveplan testPlan = {};
setupPlan(&testPlan);
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -444,7 +444,7 @@ void TestPlan::testVpmbMetric45m30minTx()
setupPlanVpmb45m30mTx(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -474,7 +474,7 @@ void TestPlan::testVpmbMetric60m10minTx()
setupPlanVpmb60m10mTx(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -504,7 +504,7 @@ void TestPlan::testVpmbMetric60m30minAir()
setupPlanVpmb60m30minAir(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -534,7 +534,7 @@ void TestPlan::testVpmbMetric60m30minEan50()
setupPlanVpmb60m30minEan50(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -570,7 +570,7 @@ void TestPlan::testVpmbMetric60m30minTx()
setupPlanVpmb60m30minTx(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -606,7 +606,7 @@ void TestPlan::testVpmbMetric100m60min()
setupPlanVpmb100m60min(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -648,7 +648,7 @@ void TestPlan::testVpmbMetricMultiLevelAir()
setupPlanVpmbMultiLevelAir(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -678,7 +678,7 @@ void TestPlan::testVpmbMetric100m10min()
setupPlanVpmb100m10min(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -724,7 +724,7 @@ void TestPlan::testVpmbMetricRepeat()
setupPlanVpmb30m20min(&testPlan);
setCurrentAppState("PlanDive");
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -744,7 +744,7 @@ void TestPlan::testVpmbMetricRepeat()
int firstDiveRunTimeSeconds = displayed_dive.dc.duration.seconds;
setupPlanVpmb100mTo70m30min(&testPlan);
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);
@ -780,7 +780,7 @@ void TestPlan::testVpmbMetricRepeat()
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 127u * 60u + 20u, 127u * 60u + 20u));
setupPlanVpmb30m20min(&testPlan);
plan(&testPlan, &cache, 1, 0);
plan(&testPlan, &displayed_dive, 60, &cache, 1, 0);
#if DEBUG
free(displayed_dive.notes);