aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/deco.c8
-rw-r--r--test/deco_test.c8
2 files changed, 2 insertions, 14 deletions
diff --git a/src/deco.c b/src/deco.c
index dca164f..7a7b736 100644
--- a/src/deco.c
+++ b/src/deco.c
@@ -121,12 +121,8 @@ gas_t gas_new(unsigned char o2, unsigned char he, double mod)
{
assert(o2 + he <= 100);
- if (mod == MOD_AUTO) {
- double mod_po2 = PO2_MAX / (o2 / 100.0);
- double mod_end = END_MAX / (1 - he / 100.0);
-
- mod = min(mod_po2, mod_end);
- }
+ if (mod == MOD_AUTO)
+ mod = PO2_MAX / (o2 / 100.0);
return (gas_t){.o2 = o2, .he = he, .n2 = 100 - o2 - he, .mod = mod};
}
diff --git a/test/deco_test.c b/test/deco_test.c
index b405970..0662b46 100644
--- a/test/deco_test.c
+++ b/test/deco_test.c
@@ -21,10 +21,7 @@ MU_TEST(test_abs_gauge)
MU_TEST(test_gas)
{
- double max_mod_err = 1E-3;
-
gas_t foo = gas_new(21, 35, MOD_AUTO);
- gas_t bar = gas_new(21, 0, MOD_AUTO);
gas_t baz = gas_new(21, 35, MOD_AUTO);
gas_t qux = gas_new(21, 35, 99);
@@ -33,13 +30,8 @@ MU_TEST(test_gas)
mu_assert_int_eq(44, gas_n2(&foo));
mu_check(gas_equal(&foo, &foo));
- mu_check(!gas_equal(&foo, &bar));
mu_check(gas_equal(&foo, &baz));
mu_check(!gas_equal(&foo, &qux));
-
- mu_assert_double_near(abs_depth(msw_to_bar(51.6)), gas_mod(&foo), max_mod_err);
- mu_assert_double_near(abs_depth(msw_to_bar(30)), gas_mod(&bar), max_mod_err);
- mu_assert_double_near(99, gas_mod(&qux), max_mod_err);
}
void testsuite_deco_setup(void)