Skip to content

Commit 09f6f6a

Browse files
committed
Increased test coverage
Signed-off-by: Marvin Hansen <[email protected]>
1 parent fa84fde commit 09f6f6a

File tree

3 files changed

+5
-57
lines changed

3 files changed

+5
-57
lines changed

deep_causality/src/utils_test/test_utils.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,6 @@ pub fn get_test_causaloid() -> BaseCausaloid {
104104
)),
105105
};
106106

107-
if obs.is_infinite() {
108-
return Err(CausalityError("Observation is infinite".into()));
109-
}
110-
111-
if obs.is_sign_negative() {
112-
return Err(CausalityError("Observation is negative".into()));
113-
}
114-
115107
let threshold: NumericalValue = 0.55;
116108
if !obs.ge(&threshold) {
117109
Ok(PropagatingEffect::Deterministic(false))

deep_causality/src/utils_test/test_utils_array_grid.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,3 @@ pub fn get_1d_array_grid(val: i32) -> AdjustmentData {
2525

2626
ag
2727
}
28-
29-
pub fn _get_3d_array_grid(v1: i32, v2: i32, v3: i32) -> AdjustmentData {
30-
let array_type = ArrayType::Array3D;
31-
let ag: ArrayGrid<i32, WIDTH, HEIGHT, DEPTH, TIME> = ArrayGrid::new(array_type);
32-
33-
// Create a 3D PointIndex for each of the updated x,y,z coordinates
34-
let p1 = PointIndex::new3d(0, 0, 0);
35-
let p2 = PointIndex::new3d(0, 0, 1);
36-
let p3 = PointIndex::new3d(0, 0, 2);
37-
38-
// Store an i32 with th position of the point index
39-
ag.set(p1, v1);
40-
ag.set(p2, v2);
41-
ag.set(p3, v3);
42-
43-
ag
44-
}
45-
46-
pub fn _get_4d_array_grid(v1: i32, v2: i32, v3: i32, t: i32) -> AdjustmentData {
47-
let array_type = ArrayType::Array4D;
48-
let ag: ArrayGrid<i32, WIDTH, HEIGHT, DEPTH, TIME> = ArrayGrid::new(array_type);
49-
50-
// Create a 4D PointIndex for each of the updated x,y,z coordinates plus time t
51-
let p1 = PointIndex::new4d(0, 0, 0, 0);
52-
let p2 = PointIndex::new4d(0, 0, 0, 1);
53-
let p3 = PointIndex::new4d(0, 0, 0, 2);
54-
let pt = PointIndex::new4d(0, 0, 0, 3);
55-
56-
// Store an i32 with th position of the point index
57-
ag.set(p1, v1);
58-
ag.set(p2, v2);
59-
ag.set(p3, v3);
60-
ag.set(pt, t);
61-
62-
ag
63-
}

deep_causality/src/utils_test/test_utils_graph.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,15 @@
66
use crate::*;
77

88
const SMALL: usize = 9;
9-
// const MEDIUM: usize = 1_00;
10-
// const LARGE: usize = 1_000;
11-
129
fn get_test_causaloid() -> BaseCausaloid {
1310
let id: IdentificationValue = 1;
1411
let description = "tests whether data exceeds threshold of 0.55";
1512
fn causal_fn(evidence: &Evidence) -> Result<PropagatingEffect, CausalityError> {
16-
let obs =
17-
match evidence {
18-
// If it's the Numerical variant, extract the inner value.
19-
Evidence::Numerical(val) => *val,
20-
// For any other type of evidence, this function cannot proceed, so return an error.
21-
_ => return Err(CausalityError(
22-
"Causal function expected Numerical evidence but received a different variant."
23-
.into(),
24-
)),
25-
};
13+
let obs = match evidence {
14+
// If it's the Numerical variant, extract the inner value.
15+
Evidence::Numerical(val) => *val,
16+
_ => 99.0, // For any other type of evidence
17+
};
2618
let threshold: NumericalValue = 0.55;
2719
if !obs.ge(&threshold) {
2820
Ok(PropagatingEffect::Deterministic(false))

0 commit comments

Comments
 (0)