annotate src/Tests/deco_volume_test.cpp @ 501:69a98f3f3b84

minor
author heinrichsweikamp
date Mon, 22 May 2017 23:03:21 +0200
parents af13a18a233b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
1 //////////////////////////////////////////////////////////////////////////////
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
2 /// deco_volume_test.cpp
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
3 /// Unit test for gas consumption c code.
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
4 /// Copyright (c) 2015, JD Gascuel, HeinrichsWeikamp, all right reserved.
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
5 //////////////////////////////////////////////////////////////////////////////
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
6 // HISTORY
288
08986d479b94 FIX gas_volume shall read gas switches from char_O_deco_gas
jdg@air
parents: 286
diff changeset
7 // 2015-05-27 jDG: Creation for gas volum re-introduction in hwOS 1.82
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
8
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
9 extern "C" {
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
10 # include "p2_deco.c"
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
11 }
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
12
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
13 #include <gtest/gtest.h>
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
14 #include <iostream>
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
15
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
16 //////////////////////////////////////////////////////////////////////////////
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
17 /// \brief Defines a default OC gas list
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
18 static void setup_gas()
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
19 {
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
20 char_I_first_gas = 1;
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
21
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
22 #define DEFINE_GAS(gas, o2, he, depth, role) \
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
23 char_I_deco_N2_ratio [gas-1] = 100 - o2 - he; \
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
24 char_I_deco_He_ratio [gas-1] = he; \
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
25 char_I_deco_gas_change[gas-1] = depth;
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
26
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
27 DEFINE_GAS(1, 21, 0, 0, 1); // Gas#1 : Air FIRST
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
28 DEFINE_GAS(2, 18, 30, 0, 2); // Gas#2 : Tx18/30 TRAVEL
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
29 DEFINE_GAS(3, 80, 0, 9, 3); // Gas#3 : Nx80 @ 9m DECO
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
30 DEFINE_GAS(4, 21, 0, 0, 0); // Gas#2 : air @ 10m DISABLED
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
31 DEFINE_GAS(5, 21, 0, 0, 0); // Gas#2 : air @ 40m DISABLED
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
32 }
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
33
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
34 //////////////////////////////////////////////////////////////////////////////
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
35 /// \brief Define a default deco plan.
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
36 static void setup_plan(const char* stops,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
37 const char* gas)
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
38 {
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
39 int depth = 3 * (stops ? strlen(stops) : 0);
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
40
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
41 if( ! depth )
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
42 std::cout << " no deco" << std::endl;
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
43
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
44 int s = 0;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
45 while( depth > 0 && s < NUM_STOPS ) {
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
46 std::cout << " " << std::setw(2) << int(stops[s]) << "' @ " << depth << "m" << std::endl;
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
47
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
48 char_O_deco_time [s] = stops[s];
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
49 char_O_deco_depth[s] = depth;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
50 char_O_deco_gas [s] = gas ? gas[s] : 1; // Gas#1 by default
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
51 ++s;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
52 depth -= 3;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
53 }
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
54 // Done
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
55 for(; s<NUM_STOPS; ++s) {
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
56 char_O_deco_time [s] = 0;
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
57 char_O_deco_depth[s] = 0;
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
58 char_O_deco_gas [s] = 0;
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
59 }
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
60 }
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
61
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
62 static void setup_dive(int bottom, int depth,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
63 const char* stops = 0, const char* gas = 0)
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
64 {
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
65 setup_gas();
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
66 setup_plan(stops, gas);
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
67
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
68 char_I_bottom_depth = depth;
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
69 char_I_bottom_time = bottom;
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
70 }
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
71
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
72 //////////////////////////////////////////////////////////////////////////////
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
73 /// \brief Gas consumption at a fixed depth
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
74 static float fixed(int rmv, int time, int depth) {
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
75 return rmv * time * (1 + 0.1f*depth);
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
76 }
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
77
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
78 TEST(gas_volume, fixed)
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
79 {
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
80 EXPECT_EQ(20*30*1, fixed(20,30, 0)); // 30' @ 0m
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
81 EXPECT_EQ(20*30*5, fixed(20,30,40)); // 30' @ 40m
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
82 }
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
83
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
84 //////////////////////////////////////////////////////////////////////////////
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
85 /// \brief Gas consumption during an ascent at 10m/min.
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
86 static float ascent(int rmv, int oldDepth, int newDepth)
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
87 {
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
88 return rmv
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
89 * abs(oldDepth-newDepth)*0.1f // Ascent time
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
90 * (1 + 0.05f*(oldDepth + newDepth)); // Avg pressure.
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
91 }
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
92
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
93 TEST(gas_volume, ascent)
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
94 {
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
95 EXPECT_EQ(0, ascent(20, 30, 30)); // 30m -> 30m : no time, no conso
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
96 EXPECT_EQ(20*4*(1+2), ascent(20, 40, 0)); // 40m -> 0m : 4min, avg 20m
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
97 EXPECT_EQ(20*4*(1+2), ascent(20, 0, 40)); // 0m -> 40m : 4min, avg 20m
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
98 }
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
99
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
100 static void check_volumes(float G1, const char* L1,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
101 float G2, const char* L2,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
102 float G3, const char* L3,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
103 float G4, const char* L4,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
104 float G5, const char* L5)
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
105 {
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
106 std::cout << " " << std::setw(6) << G1 << " = " << L1 << std::endl;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
107 std::cout << " " << std::setw(6) << G2 << " = " << L2 << std::endl;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
108 std::cout << " " << std::setw(6) << G3 << " = " << L3 << std::endl;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
109 std::cout << " " << std::setw(6) << G4 << " = " << L4 << std::endl;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
110 std::cout << " " << std::setw(6) << G5 << " = " << L5 << std::endl;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
111
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
112 EXPECT_NEAR(G1, int_O_gas_volumes[0], 1) << L1;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
113 EXPECT_NEAR(G2, int_O_gas_volumes[1], 1) << L2;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
114 EXPECT_NEAR(G3, int_O_gas_volumes[2], 1) << L3;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
115 EXPECT_NEAR(G4, int_O_gas_volumes[3], 1) << L4;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
116 EXPECT_NEAR(G5, int_O_gas_volumes[4], 1) << L5;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
117 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
118
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
119 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
120 // v1.82 ZH-L16+GF, OC, 30%/85%
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
121 TEST(gas_volume, OC_13min30m)
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
122 {
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
123 char_I_const_ppO2 = 0; // OC
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
124 setup_dive(13, 30); // 13' @ 30m --> no deco
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
125
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
126 ASSERT_NO_THROW( deco_gas_volumes() );
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
127 check_volumes(fixed(20,13,30) + ascent(20,30,0), "Gas1: 1190 L",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
128 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
129 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
130 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
131 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
132 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
133
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
134 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
135 // v1.82 ZH-L16+GF, OC, 30%/85%
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
136 TEST(gas_volume, OC_15min30m)
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
137 {
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
138 char_I_const_ppO2 = 0; // OC
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
139 char stops[] = {1, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
140 char gas[] = {3, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
141 setup_dive(15, 30, stops, gas); // 15' @ 30m --> 1min at 3m
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
142
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
143 ASSERT_NO_THROW( deco_gas_volumes() );
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
144 check_volumes(fixed(20,15,30) + ascent(20,30,3), "Gas1: 1343 L",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
145 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
146 fixed(20, 1, 3) + ascent(20, 3,0), "Gas3: 33",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
147 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
148 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
149 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
150
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
151 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
152 // v1.82 ZH-L16+GF, OC, 30%/85%
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
153 TEST(gas_volume, OC_29min30m)
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
154 {
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
155 char_I_const_ppO2 = 0; // OC
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
156 char stops[] = {1, 1, 2, 4, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
157 char gas[] = {1, 3, 3, 3, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
158 setup_dive(29, 30, stops, gas); // 29' @ 30m --> 1' 1' 2' 4'
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
159
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
160 ASSERT_NO_THROW( deco_gas_volumes() );
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
161 check_volumes(fixed(20,29,30) + ascent(20,30,12) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
162 fixed(20, 1,12) + ascent(20,12, 9), "Gas1: 2488 L",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
163 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
164 fixed(20, 1, 9) + ascent(20, 9, 6) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
165 fixed(20, 2, 6) + ascent(20, 6, 3) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
166 fixed(20, 4, 3) + ascent(20, 3, 0), "Gas3: 232 L",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
167 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
168 0, "");
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
169 }
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
170
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
171 //////////////////////////////////////////////////////////////////////////////
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
172 // v1.82 ZH-L16+GF, OC, 30%/85%
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
173 TEST(gas_volume, OC_15min60m)
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
174 {
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
175 char_I_const_ppO2 = 0; // OC
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
176 char stops[] = {2, 1, 2, 4, 3, 4, 9, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
177 char gas[] = {1, 1, 1, 1, 3, 3, 3, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
178 setup_dive(15, 60, stops, gas); // 15' @ 60m --> DTR 32'
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
179
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
180 ASSERT_NO_THROW( deco_gas_volumes() );
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
181 check_volumes(fixed(20,15,60) + ascent(20,60,21) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
182 fixed(20, 2,21) + ascent(20,21,18) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
183 fixed(20, 1,18) + ascent(20,18,15) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
184 fixed(20, 2,15) + ascent(20,15,12) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
185 fixed(20, 4,12) + ascent(20,12, 9), "Gas1: 3010 L",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
186 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
187 fixed(20, 3, 9) + ascent(20, 9, 6) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
188 fixed(20, 4, 6) + ascent(20, 6, 3) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
189 fixed(20, 9, 3) + ascent(20, 3, 0), "Gas3: 502 L",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
190 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
191 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
192 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
193
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
194 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
195 // v1.82 ZH-L16+GF, CCR, 30%/85%
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
196 TEST(gas_volume, CCR_23min30m)
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
197 {
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
198 char_I_const_ppO2 = 140;// SP 1.4 bar
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
199 setup_dive(23, 30); // 23' @ 30m --> no deco / no BAIL deco
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
200
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
201 ASSERT_NO_THROW( deco_gas_volumes() );
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
202 check_volumes(/*NO BTM CONSO*/ ascent(20,30,0), "Gas1: 150 L",
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
203 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
204 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
205 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
206 0, "");
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
207 }
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
208
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
209 //////////////////////////////////////////////////////////////////////////////
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
210 // v1.82 ZH-L16+GF, CCR, 30%/85%
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
211 TEST(gas_volume, CCR_25min30m)
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
212 {
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
213 char_I_const_ppO2 = 140;// SP 1.4 bar
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
214 char stops[] = {1, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
215 char gas[] = {3, 0};
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
216 setup_dive(25, 30, stops, gas); // 25' @ 30m --> no deco / BAIL 1' @ 3m
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
217
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
218 ASSERT_NO_THROW( deco_gas_volumes() );
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
219 check_volumes(/*NO BTM CONSO*/ ascent(20,30,3), "Gas1: 143 L",
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
220 0, "",
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
221 fixed(20, 1, 3) + ascent(20, 3,0), "Gas3: 33 L",
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
222 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
223 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
224 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
225
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
226 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
227 // v1.82 ZH-L16+GF, CCR, 30%/85%
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
228 TEST(gas_volume, CCR_45min30m)
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
229 {
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
230 char_I_const_ppO2 = 140; // SP 1.4 bar
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
231 char stops[] = {1, 2, 5, 0};
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
232 char gas[] = {3, 3, 3, 0};
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
233 setup_dive(45, 30, stops, gas); // 45' @ 30m
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
234
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
235 ASSERT_NO_THROW( deco_gas_volumes() );
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
236 check_volumes(/*NO BTM CONSO*/ ascent(20,30, 9), "Gas1: 124 L",
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
237 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
238 fixed(20, 1, 9) + ascent(20, 9, 6) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
239 fixed(20, 2, 6) + ascent(20, 6, 3) +
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
240 fixed(20, 5, 3) + ascent(20, 3, 0), "Gas3: 258 L",
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
241 0, "",
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
242 0, "");
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
243 }
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
244
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
245 //////////////////////////////////////////////////////////////////////////////
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
246 // v1.82 ZH-L16+GF, CCR, 30%/85%
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
247 TEST(gas_volume, CCR_19min51m)
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
248 {
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
249 char_I_const_ppO2 = 140; // SP 1.4 bar
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
250 char stops[] = {1, 2, 2, 4, 3, 4, 9, 0};
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
251 char gas[] = {1, 1, 1, 1, 3, 3, 3, 0};
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
252 setup_dive(19, 51, stops, gas); // 19' @ 51m --> 20' CCR / 31' BAIL
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
253
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
254 ASSERT_NO_THROW( deco_gas_volumes() );
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
255 check_volumes(/*NO BTM CONSO*/ ascent(20,51,21) +
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
256 fixed(20, 1,21) + ascent(20,21,18) +
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
257 fixed(20, 2,18) + ascent(20,18,15) +
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
258 fixed(20, 2,15) + ascent(20,15,12) +
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
259 fixed(20, 4,12) + ascent(20,12, 9), "Gas1: 786 L",
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
260 0, "",
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
261 fixed(20, 3, 9) + ascent(20, 9, 6) +
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
262 fixed(20, 4, 6) + ascent(20, 6, 3) +
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 293
diff changeset
263 fixed(20, 9, 3) + ascent(20, 3, 0), "Gas3: 502 L",
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
264 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
265 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
266 }
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
267
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
268 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
269 // v1.82 ZH-L16+GF, CCR, 30%/85%
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
270 TEST(gas_volume, CCR_15min60m)
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
271 {
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
272 char_I_const_ppO2 = 140; // SP 1.4 bar
296
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
273 char stops[] = {2, 1, 1, 3, 5, 4, 8, 0}; // BAILOUT mode
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
274 char gas[] = {3, 3, 3, 3, 3, 5, 5, 0};
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
275 setup_dive(15, 60, stops, gas); // 15' @ 60m --> DTR 32'
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
276
296
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
277 DEFINE_GAS(3, 32, 0, 40, 3); // Gas#3 : Nx32 @ 40m DECO
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
278 DEFINE_GAS(5, 90, 0, 6, 3); // Gas#5 : Nx90 @ 6m DECO
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
279
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
280 ASSERT_NO_THROW( deco_gas_volumes() );
296
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
281 check_volumes(/*NO BTM CONSO*/ ascent(20,60,21), "Gas1: 394 L",
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
282 0, "",
296
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
283 fixed(20, 2,21) + ascent(20,21,18) +
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
284 fixed(20, 1,18) + ascent(20,18,15) +
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
285 fixed(20, 1,15) + ascent(20,15,12) +
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
286 fixed(20, 3,12) + ascent(20,12, 9) +
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
287 fixed(20, 5, 9) + ascent(20, 9, 6), "Gas3: 623 L",
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
288 0, "",
296
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
289 fixed(20, 4, 6) + ascent(20, 6, 3) +
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
290 fixed(20, 8, 3) + ascent(20, 3, 0), "Gas5: 352 L");
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
291 }