annotate src/Tests/deco_volume_test.cpp @ 294:f97e439d711c

FIX clear before displaying gas volumes.
author jDG
date Sat, 30 May 2015 22:58:00 +0200
parents 6d6b3689b20b
children 7027d735ac62
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
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
41 int s = 0;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
42 while( depth > 0 && s < NUM_STOPS ) {
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
43 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
44 char_O_deco_depth[s] = depth;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
45 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
46 ++s;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
47 depth -= 3;
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
48 }
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
49 // Done
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
50 for(; s<NUM_STOPS; ++s) {
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
51 char_O_deco_time [s] = 0;
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
52 char_O_deco_depth[s] = 0;
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
53 char_O_deco_gas [s] = 0;
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
54 }
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
55 }
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
56
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
57 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
58 const char* stops = 0, const char* gas = 0)
285
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 setup_gas();
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
61 setup_plan(stops, gas);
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
62
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
63 char_I_bottom_depth = depth;
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
64 char_I_bottom_time = bottom;
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
65 }
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
66
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
67 //////////////////////////////////////////////////////////////////////////////
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
68 /// \brief Gas consumption at a fixed depth
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
69 static float fixed(int rmv, int time, int depth) {
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
70 return rmv * time * (1 + 0.1f*depth);
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 TEST(gas_volume, fixed)
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
74 {
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
75 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
76 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
77 }
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
78
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 /// \brief Gas consumption during an ascent at 10m/min.
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
81 static float ascent(int rmv, int oldDepth, int newDepth)
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 return rmv
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
84 * abs(oldDepth-newDepth)*0.1f // Ascent time
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
85 * (1 + 0.05f*(oldDepth + newDepth)); // Avg pressure.
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
86 }
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 TEST(gas_volume, ascent)
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
89 {
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
90 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
91 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
92 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
93 }
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
94
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
95 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
96 float G2, const char* L2,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
97 float G3, const char* L3,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
98 float G4, const char* L4,
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
99 float G5, const char* L5)
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
100 {
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
101 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
102 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
103 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
104 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
105 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
106
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
107 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
108 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
109 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
110 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
111 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
112 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
113
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
114 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
115 // 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
116 TEST(gas_volume, OC_13min30m)
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 char_I_const_ppO2 = 0; // OC
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
119 setup_dive(13, 30); // 13' @ 30m --> no deco
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
120
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
121 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
122 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
123 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
124 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
125 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
126 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
127 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
128
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
129 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
130 // 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
131 TEST(gas_volume, OC_15min30m)
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 char_I_const_ppO2 = 0; // OC
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
134 char stops[] = {1, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
135 char gas[] = {3, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
136 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
137
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
138 ASSERT_NO_THROW( deco_gas_volumes() );
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
139 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
140 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
141 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
142 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
143 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
144 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
145
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
146 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
147 // 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
148 TEST(gas_volume, OC_29min30m)
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 char_I_const_ppO2 = 0; // OC
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
151 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
152 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
153 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
154
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
155 ASSERT_NO_THROW( deco_gas_volumes() );
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
156 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
157 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
158 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
159 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
160 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
161 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
162 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
163 0, "");
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
164 }
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
165
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
166 //////////////////////////////////////////////////////////////////////////////
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
167 // 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
168 TEST(gas_volume, OC_15min60m)
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
169 {
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
170 char_I_const_ppO2 = 0; // OC
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
171 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
172 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
173 setup_dive(15, 60, stops, gas); // 15' @ 60m --> DTR 32'
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
174
286
729b01914098 NEW test w/o stops and with stops
jdg@air
parents: 285
diff changeset
175 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
176 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
177 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
178 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
179 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
180 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
181 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
182 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
183 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
184 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
185 0, "",
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 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
188
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
189 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
190 // 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
191 TEST(gas_volume, CCR_13min30m)
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 char_I_const_ppO2 = 140;// SP 1.4 bar
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
194 setup_dive(13, 30); // 13' @ 30m --> no deco
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
195
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
196 ASSERT_NO_THROW( deco_gas_volumes() );
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
197 check_volumes(/*NO BTM CONSO*/ 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
198 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
199 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
200 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
201 0, "");
285
cd2320cd6f9a NEW unit tests for gas volumes...
jdg@air
parents:
diff changeset
202 }
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
203
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
204 //////////////////////////////////////////////////////////////////////////////
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
205 // 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
206 TEST(gas_volume, CCR_15min30m)
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
207 {
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
208 char_I_const_ppO2 = 140; // SP 1.4 bar
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
209 char stops[] = {1, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
210 char gas[] = {3, 0};
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
211 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
212
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
213 ASSERT_NO_THROW( deco_gas_volumes() );
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
214 check_volumes(/*NO BTM CONSO*/ 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
215 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
216 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
217 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
218 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
219 }
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
220
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
221 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
222 // 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
223 TEST(gas_volume, CCR_29min30m)
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 char_I_const_ppO2 = 140; // SP 1.4 bar
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
226 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
227 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
228 setup_dive(29, 30, stops, gas); // 29' @ 30m --> 1' 1' 2' 4'
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
229
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
230 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
231 check_volumes(/*NO BTM CONSO*/ ascent(20,30,12) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
232 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
233 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
234 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
235 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
236 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
237 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
238 0, "");
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
239 }
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
240
293
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
241 //////////////////////////////////////////////////////////////////////////////
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
242 // 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
243 TEST(gas_volume, CCR_15min60m)
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
244 {
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
245 char_I_const_ppO2 = 140; // SP 1.4 bar
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
246 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
247 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
248 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
249
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
250 ASSERT_NO_THROW( deco_gas_volumes() );
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
251 check_volumes(/*NO BTM CONSO*/ ascent(20,60,21) +
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
252 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
253 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
254 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
255 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
256 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
257 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
258 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
259 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
260 0, "",
6d6b3689b20b FIX tests to use plans copyed from actual OSTC3 1.82 computer.
jDG
parents: 290
diff changeset
261 0, "");
290
b1e47ee1f0a1 NEW gas_volume unit test in CCR mode. Works too.
jdg@air
parents: 288
diff changeset
262 }