master > master: code-rust - String-type macro
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
use rstest::fixture;
|
||||
use rstest::rstest;
|
||||
use std::panic::catch_unwind;
|
||||
|
||||
use ads2::graphs::graph;
|
||||
use ads2::*;
|
||||
@@ -25,28 +26,21 @@ fn fixture_graph() -> graph::Graph<i32> {
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
#[test]
|
||||
fn test_graph_create_noerror() {
|
||||
let result = std::panic::catch_unwind(|| {
|
||||
fn test_graph_creation() {
|
||||
assert!(catch_unwind(|| {
|
||||
let gph = graph::Graph::new(
|
||||
vec![5, 7, 8],
|
||||
vec![(5,7), (7, 8)]
|
||||
);
|
||||
assert_length!(gph, 3);
|
||||
});
|
||||
assert!(result.is_ok());
|
||||
let result = std::panic::catch_unwind(|| {
|
||||
let gph = graph::Graph::new(
|
||||
vec!["5", "7", "8", "10"],
|
||||
vec![("5", "7"), ("7", "8")]
|
||||
);
|
||||
assert_length!(gph, 4);
|
||||
});
|
||||
assert!(result.is_ok());
|
||||
let result = std::panic::catch_unwind(|| {
|
||||
let gph = graph::Graph::<f64>::new(Vec::new(), Vec::new());
|
||||
assert_length!(gph, 0);
|
||||
});
|
||||
assert!(result.is_ok());
|
||||
}).is_ok());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
|
||||
Reference in New Issue
Block a user