1 unstable release

0.1.0 Nov 11, 2020

#2405 in Algorithms

MPL-2.0 license

12KB
203 lines

C3 Linearization

use std::collections::HashMap;
use c3_linearization::C3;

#[test]
fn basic() {
    let c3 = C3::default();
    let mut input = HashMap::new();
    input.insert('A', vec!['B', 'C']);
    input.insert('B', vec![]);
    input.insert('C', vec!['D']);
    input.insert('D', vec![]);
    let mut target = HashMap::new();
    target.insert('A', vec!['A', 'B', 'C', 'D']);
    target.insert('B', vec!['B']);
    target.insert('C', vec!['C', 'D']);
    target.insert('D', vec!['D']);
    assert_eq!(target, c3.linearize(input).unwrap())
}

No runtime deps