Skip to content

Commit bbf4879

Browse files
committed
test(deep_causality_uncertain): Increased test coverage.
Signed-off-by: Marvin Hansen <[email protected]>
1 parent 4e5b4a4 commit bbf4879

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

deep_causality_uncertain/tests/types/cache/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
*/
55
#[cfg(test)]
66
mod cache_tests;
7+
mod sampled_value_tests;
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* SPDX-License-Identifier: MIT
3+
* Copyright (c) "2025" . The DeepCausality Authors and Contributors. All Rights Reserved.
4+
*/
5+
use deep_causality_uncertain::SampledValue;
6+
7+
#[test]
8+
fn test_sampled_value_float_display() {
9+
let val = SampledValue::Float(123.45);
10+
assert_eq!(format!("{}", val), "123.45");
11+
}
12+
13+
#[test]
14+
fn test_sampled_value_bool_display() {
15+
let val_true = SampledValue::Bool(true);
16+
assert_eq!(format!("{}", val_true), "true");
17+
18+
let val_false = SampledValue::Bool(false);
19+
assert_eq!(format!("{}", val_false), "false");
20+
}
21+
22+
#[test]
23+
fn test_sampled_value_float_debug() {
24+
let val = SampledValue::Float(123.45);
25+
assert_eq!(format!("{:?}", val), "Float(123.45)");
26+
}
27+
28+
#[test]
29+
fn test_sampled_value_bool_debug() {
30+
let val_true = SampledValue::Bool(true);
31+
assert_eq!(format!("{:?}", val_true), "Bool(true)");
32+
33+
let val_false = SampledValue::Bool(false);
34+
assert_eq!(format!("{:?}", val_false), "Bool(false)");
35+
}
36+
37+
#[test]
38+
fn test_sampled_value_float_clone() {
39+
let val = SampledValue::Float(123.45);
40+
let cloned_val = val;
41+
assert_eq!(val, cloned_val);
42+
}
43+
44+
#[test]
45+
fn test_sampled_value_bool_clone() {
46+
let val = SampledValue::Bool(true);
47+
let cloned_val = val;
48+
assert_eq!(val, cloned_val);
49+
}
50+
51+
#[test]
52+
fn test_sampled_value_float_copy() {
53+
let val = SampledValue::Float(123.45);
54+
let copied_val = val; // Copy happens implicitly
55+
assert_eq!(val, copied_val);
56+
}

0 commit comments

Comments
 (0)