master > master: code-rust - Bsp hinzugefügt
This commit is contained in:
		
							parent
							
								
									4b2c73b9f8
								
							
						
					
					
						commit
						6da791d7bb
					
				@ -31,6 +31,28 @@ fn fixture_graph2() -> graph::Graph<i32> {
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[fixture]
 | 
			
		||||
fn fixture_graph3() -> graph::Graph<i32> {
 | 
			
		||||
    return graph::Graph::<i32>::new(
 | 
			
		||||
        vec![1,2,3,4,5,6,7,8],
 | 
			
		||||
        vec![
 | 
			
		||||
            (1,2),
 | 
			
		||||
            (1,3),
 | 
			
		||||
            (2,4),
 | 
			
		||||
            (2,5),
 | 
			
		||||
            (3,5),
 | 
			
		||||
            (3,6),
 | 
			
		||||
            (3,8),
 | 
			
		||||
            (4,5),
 | 
			
		||||
            (4,7),
 | 
			
		||||
            (5,1),
 | 
			
		||||
            (5,8),
 | 
			
		||||
            (6,8),
 | 
			
		||||
            (7,8),
 | 
			
		||||
        ],
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------
 | 
			
		||||
// Test Graph
 | 
			
		||||
// ----------------------------------------------------------------
 | 
			
		||||
@ -38,13 +60,12 @@ fn fixture_graph2() -> graph::Graph<i32> {
 | 
			
		||||
#[rstest]
 | 
			
		||||
#[case(fixture_graph1(), vec![vec![1], vec![3], vec![2,4]])]
 | 
			
		||||
#[case(fixture_graph2(), vec![vec![1], vec![6], vec![7], vec![2,3,4,5]])]
 | 
			
		||||
#[case(fixture_graph3(), vec![vec![8], vec![7], vec![6], vec![3, 5, 4, 2, 1]])]
 | 
			
		||||
fn test_tarjan<T>(#[case] gph: graph::Graph<T>, #[case] expected: Vec<Vec<T>>)
 | 
			
		||||
    where T: Eq + Hash + Clone + Display
 | 
			
		||||
{
 | 
			
		||||
    assert_components_eq(
 | 
			
		||||
        &tarjan::tarjan_algorithm(&gph),
 | 
			
		||||
        &expected
 | 
			
		||||
    )
 | 
			
		||||
    let components = tarjan::tarjan_algorithm(&gph);
 | 
			
		||||
    assert_components_eq(&components, &expected)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user