Skip to content

Commit

Permalink
Run npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanocokoljic committed Feb 2, 2024
1 parent 91b6766 commit b62a316
Show file tree
Hide file tree
Showing 12 changed files with 3,861 additions and 14,096 deletions.
2 changes: 1 addition & 1 deletion src/jos3_functions/thermoregulation/fixed_hc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export function fixed_hc(hc, v) {
math.sum(math.dotMultiply(v, JOS3Defaults.local_bsa)) / local_bsa_sum;

let mean_hc_whole = Math.max(3, 8.600001 * mean_va ** 0.53);
return math.dotDivide(math.dotMultiply(hc, mean_hc_whole), mean_hc)
return math.dotDivide(math.dotMultiply(hc, mean_hc_whole), mean_hc);
}
20 changes: 3 additions & 17 deletions tests/jos3_functions/thermoregulation/clo_area_factor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,9 @@ import * as math from "mathjs";
describe("clo_area_factor", () => {
it("should return the correct value", () => {
const expected = [
1.0,
1.0125,
1.025,
1.0375,
1.05,
1.0625,
1.075,
1.0875,
1.1,
1.10625,
1.1125,
1.1187500000000001,
1.125,
1.13125,
1.1375,
1.14375,
1.1500000000000001
1.0, 1.0125, 1.025, 1.0375, 1.05, 1.0625, 1.075, 1.0875, 1.1, 1.10625,
1.1125, 1.1187500000000001, 1.125, 1.13125, 1.1375, 1.14375,
1.1500000000000001,
];

const result = clo_area_factor(math.matrix($lerp(17, 0, 1)));
Expand Down
35 changes: 12 additions & 23 deletions tests/jos3_functions/thermoregulation/dry_r.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,23 @@ import * as math from "mathjs";

describe("dry_r", () => {
it("should throw an error if hc or hr are negative", () => {
expect(() => dry_r(math.matrix([-1]), math.matrix([]), math.matrix([]))).toThrow(
"Input parameters hc and hr must be non-negative.",
);
expect(() =>
dry_r(math.matrix([-1]), math.matrix([]), math.matrix([])),
).toThrow("Input parameters hc and hr must be non-negative.");

expect(() => dry_r(math.matrix([]), math.matrix([-1]), math.matrix([]))).toThrow(
"Input parameters hc and hr must be non-negative.",
);
expect(() =>
dry_r(math.matrix([]), math.matrix([-1]), math.matrix([])),
).toThrow("Input parameters hc and hr must be non-negative.");
});

it("should return the correct value", () => {
const expected = [
0.5,
0.44864497599451303,
0.40961890243902443,
0.3795553806133625,
0.35621031746031745,
0.3380302601809955,
0.32390573089700997,
0.31302322796934867,
0.30477272727272725,
0.29988274759056166,
0.29662531210986265,
0.29474244707438985,
0.2940277777777778,
0.2943142429623783,
0.29546515984015986,
0.29736761998099315,
0.29992753623188406
0.5, 0.44864497599451303, 0.40961890243902443, 0.3795553806133625,
0.35621031746031745, 0.3380302601809955, 0.32390573089700997,
0.31302322796934867, 0.30477272727272725, 0.29988274759056166,
0.29662531210986265, 0.29474244707438985, 0.2940277777777778,
0.2943142429623783, 0.29546515984015986, 0.29736761998099315,
0.29992753623188406,
];

const result = dry_r(
Expand Down
66 changes: 57 additions & 9 deletions tests/jos3_functions/thermoregulation/evaporation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,67 @@ describe("evaporation", () => {
{
age: 20,
expected: {
"wet": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
"e_sk": [0.004420996652136314, 0.00116458299811076, 0.007022461588771268, 0.0064563796892369504, 0.008857260040612642, 0.003845505830562024, 0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547, 0.0025201026973817723, 0.001999706633456237, 0.008357714424343484, 0.004478471977310349, 0.002239212930092807, 0.008357442984739507, 0.004479076716683872, 0.002239880073760617],
"e_max": [0.004420996652136314, 0.00116458299811076, 0.007022461588771268, 0.0064563796892369504, 0.008857260040612642, 0.003845505830562024, 0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547, 0.0025201026973817723, 0.001999706633456237, 0.008357714424343484, 0.004478471977310349, 0.002239212930092807, 0.008357442984739507, 0.004479076716683872, 0.002239880073760617],
"e_sweat": [0.004420996652136314, 0.00116458299811076, 0.007022461588771268, 0.0064563796892369504, 0.008857260040612642, 0.003845505830562024, 0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547, 0.0025201026973817723, 0.001999706633456237, 0.008357714424343484, 0.004478471977310349, 0.002239212930092807, 0.008357442984739507, 0.004479076716683872, 0.002239880073760617]
wet: [
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
],
e_sk: [
0.004420996652136314, 0.00116458299811076, 0.007022461588771268,
0.0064563796892369504, 0.008857260040612642, 0.003845505830562024,
0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547,
0.0025201026973817723, 0.001999706633456237, 0.008357714424343484,
0.004478471977310349, 0.002239212930092807, 0.008357442984739507,
0.004479076716683872, 0.002239880073760617,
],
e_max: [
0.004420996652136314, 0.00116458299811076, 0.007022461588771268,
0.0064563796892369504, 0.008857260040612642, 0.003845505830562024,
0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547,
0.0025201026973817723, 0.001999706633456237, 0.008357714424343484,
0.004478471977310349, 0.002239212930092807, 0.008357442984739507,
0.004479076716683872, 0.002239880073760617,
],
e_sweat: [
0.004420996652136314, 0.00116458299811076, 0.007022461588771268,
0.0064563796892369504, 0.008857260040612642, 0.003845505830562024,
0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547,
0.0025201026973817723, 0.001999706633456237, 0.008357714424343484,
0.004478471977310349, 0.002239212930092807, 0.008357442984739507,
0.004479076716683872, 0.002239880073760617,
],
},
},
{
age: 61,
expected: {
"wet": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
"e_sk": [0.004420996652136314, 0.00116458299811076, 0.007022461588771268, 0.0064563796892369504, 0.008857260040612642, 0.003845505830562024, 0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547, 0.0025201026973817723, 0.001999706633456237, 0.008357714424343484, 0.004478471977310349, 0.002239212930092807, 0.008357442984739507, 0.004479076716683872, 0.002239880073760617],
"e_max": [0.004420996652136314, 0.00116458299811076, 0.007022461588771268, 0.0064563796892369504, 0.008857260040612642, 0.003845505830562024, 0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547, 0.0025201026973817723, 0.001999706633456237, 0.008357714424343484, 0.004478471977310349, 0.002239212930092807, 0.008357442984739507, 0.004479076716683872, 0.002239880073760617],
"e_sweat": [0.004420996652136314, 0.00116458299811076, 0.007022461588771268, 0.0064563796892369504, 0.008857260040612642, 0.003845505830562024, 0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547, 0.0025201026973817723, 0.001999706633456237, 0.008357714424343484, 0.004478471977310349, 0.002239212930092807, 0.008357442984739507, 0.004479076716683872, 0.002239880073760617]
wet: [
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
],
e_sk: [
0.004420996652136314, 0.00116458299811076, 0.007022461588771268,
0.0064563796892369504, 0.008857260040612642, 0.003845505830562024,
0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547,
0.0025201026973817723, 0.001999706633456237, 0.008357714424343484,
0.004478471977310349, 0.002239212930092807, 0.008357442984739507,
0.004479076716683872, 0.002239880073760617,
],
e_max: [
0.004420996652136314, 0.00116458299811076, 0.007022461588771268,
0.0064563796892369504, 0.008857260040612642, 0.003845505830562024,
0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547,
0.0025201026973817723, 0.001999706633456237, 0.008357714424343484,
0.004478471977310349, 0.002239212930092807, 0.008357442984739507,
0.004479076716683872, 0.002239880073760617,
],
e_sweat: [
0.004420996652136314, 0.00116458299811076, 0.007022461588771268,
0.0064563796892369504, 0.008857260040612642, 0.003845505830562024,
0.0025224829099062224, 0.0020012097707047096, 0.003841116172654547,
0.0025201026973817723, 0.001999706633456237, 0.008357714424343484,
0.004478471977310349, 0.002239212930092807, 0.008357442984739507,
0.004479076716683872, 0.002239880073760617,
],
},
},
])(
Expand All @@ -43,7 +91,7 @@ describe("evaporation", () => {
wet: result.wet.toArray(),
e_sk: result.e_sk.toArray(),
e_max: result.e_max.toArray(),
e_sweat: result.e_sweat.toArray()
e_sweat: result.e_sweat.toArray(),
}).toStrictEqual(expected);
},
);
Expand Down
2 changes: 1 addition & 1 deletion tests/jos3_functions/thermoregulation/local_mbase.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe("local_mbase", () => {
"returns correct value when sex is $sex and bmr_equation is $bmr_equation",
({ sex, bmr_equation, expected }) => {
const result = local_mbase(1.72, 74.43, 20, sex, bmr_equation);
expect(result.map(r => r.toArray())).toStrictEqual(expected);
expect(result.map((r) => r.toArray())).toStrictEqual(expected);
},
);
});
22 changes: 5 additions & 17 deletions tests/jos3_functions/thermoregulation/operative_temp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,11 @@ describe("operative_temp", () => {
);

const expected = [
28.0,
27.842105263157894,
27.818181818181817,
27.88,
28.0,
28.161290322580644,
28.352941176470587,
28.56756756756757,
28.8,
29.046511627906977,
29.304347826086957,
29.571428571428573,
29.846153846153847,
30.12727272727273,
30.413793103448278,
30.704918032786885,
31.0
28.0, 27.842105263157894, 27.818181818181817, 27.88, 28.0,
28.161290322580644, 28.352941176470587, 28.56756756756757, 28.8,
29.046511627906977, 29.304347826086957, 29.571428571428573,
29.846153846153847, 30.12727272727273, 30.413793103448278,
30.704918032786885, 31.0,
];

expect(result.toArray()).toStrictEqual(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, it, expect } from "@jest/globals";

describe("resp_heat_loss", () => {
it("should return the correct values", () => {
const expected = {"res_sh": 0.1456, "res_lh": -29.803748000000002};
const expected = { res_sh: 0.1456, res_lh: -29.803748000000002 };
const result = resp_heat_loss(32, 39, 52);
expect(result).toStrictEqual(expected);
});
Expand Down
23 changes: 6 additions & 17 deletions tests/jos3_functions/thermoregulation/wet_r.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,12 @@ describe("wet_r", () => {

it("should return the correct value", () => {
const expected = [
0.0021645021645021645,
0.003423575313939129,
0.004684089504371918,
0.005945984200305834,
0.007209202036788244,
0.008473688620747445,
0.009739392346802675,
0.011006264226345363,
0.012274257728803185,
0.013553503235181343,
0.014833280927405077,
0.016113575919067133,
0.01739437384598675,
0.01867566084416913,
0.019957423528852103,
0.021239648974578626,
0.02252232469623774
0.0021645021645021645, 0.003423575313939129, 0.004684089504371918,
0.005945984200305834, 0.007209202036788244, 0.008473688620747445,
0.009739392346802675, 0.011006264226345363, 0.012274257728803185,
0.013553503235181343, 0.014833280927405077, 0.016113575919067133,
0.01739437384598675, 0.01867566084416913, 0.019957423528852103,
0.021239648974578626, 0.02252232469623774,
];

const result = wet_r(
Expand Down
Loading

0 comments on commit b62a316

Please sign in to comment.