Skip to content

Commit

Permalink
Merge pull request #118 from marvin-hansen/main
Browse files Browse the repository at this point in the history
Updated dependencies
  • Loading branch information
marvin-hansen authored Oct 30, 2023
2 parents 70a9cdd + ff1199d commit f106c8c
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 106 deletions.
7 changes: 4 additions & 3 deletions deep_causality/examples/ctx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ deep_causality = "0.6.2"
# chrono default-features = false mitigates "RUSTSEC-2020-0071".
# See https://rustsec.org/advisories/RUSTSEC-2020-0071.html
chrono = { version = "0.4", default-features = false , features = ["serde", "clock"] }
parquet = "48.0"
parquet = "48"
petgraph = "0.6"
rust_decimal = "1.32"
serde = { version = "1.0", features = ["derive"] }
# default-features = false mitigates a warning of a yanked sub-sub dependency
rust_decimal = { version = "1.32", default-features = false, features = ["serde"] }
serde = { version = "1.0.190", features = ["derive"] }
13 changes: 13 additions & 0 deletions deep_causality/src/utils/math_utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: MIT
// Copyright (c) "2023" . The DeepCausality Authors. All Rights Reserved.

use std::iter::Sum;
use std::ops::Add;

use crate::types::alias_types::NumericalValue;

pub const ZERO: NumericalValue = 0.0;
Expand All @@ -14,3 +17,13 @@ pub fn abs_num(val: NumericalValue) -> NumericalValue {
MINUS_ONE * val
}
}

/// Returns the sum of all elements in an iterable.
pub fn sum<I, S>(iterable: I) -> S
where
I: IntoIterator,
S: Sum<I::Item>,
I::Item: Add<I::Item, Output = S>,
{
iterable.into_iter().sum()
}
94 changes: 0 additions & 94 deletions deep_causality/tests/errors/error_tests.rs

This file was deleted.

5 changes: 0 additions & 5 deletions deep_causality/tests/errors/mod.rs

This file was deleted.

1 change: 0 additions & 1 deletion deep_causality/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: MIT
// Copyright (c) "2023" . The DeepCausality Authors. All Rights Reserved.

mod errors;
mod extensions;
mod types;
mod utils;
34 changes: 34 additions & 0 deletions deep_causality/tests/utils/math_utils_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
// Copyright (c) "2023" . The DeepCausality Authors. All Rights Reserved.

use deep_causality::utils::math_utils;

#[test]
fn test_sum_float() {
let v = vec![1.0, 2.0, 3.0, 4.0];
let res = math_utils::sum(v);

assert_eq!(res, 10.0);
}

#[test]
fn test_sum_int() {
let v = vec![1, 2, 3, 4];
let res = math_utils::sum(v);

assert_eq!(res, 10);
}

#[test]
fn test_abs_num_neg() {
let n = -1.0;
let res = math_utils::abs_num(n);
assert_eq!(res, 1.0);
}

#[test]
fn test_abs_num_pos() {
let n = 1.0;
let res = math_utils::abs_num(n);
assert_eq!(res, 1.0);
}
2 changes: 2 additions & 0 deletions deep_causality/tests/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) "2023" . The DeepCausality Authors. All Rights Reserved.
#[cfg(test)]
mod math_utils_tests;
pub mod test_utils;
pub mod test_utils_graph;
#[cfg(test)]
Expand Down
5 changes: 2 additions & 3 deletions ultragraph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ path = "../deep_causality_macros"
version = "^0.4"



[dependencies]
ahash = "0.8"
petgraph = "0.6"
ahash = "^0.8"
petgraph = "^0.6"


[dev-dependencies]
Expand Down

0 comments on commit f106c8c

Please sign in to comment.