1
// Tests for various functionalities of the Model
2

            
3
use conjure_oxide::ast::*;
4
use std::collections::HashMap;
5

            
6
#[test]
7
fn modify_domain() {
8
    let a = Name::UserName(String::from("a"));
9

            
10
    let d1 = Domain::IntDomain(vec![Range::Bounded(1, 3)]);
11
    let d2 = Domain::IntDomain(vec![Range::Bounded(1, 2)]);
12

            
13
    let mut variables = HashMap::new();
14
    variables.insert(a.clone(), DecisionVariable { domain: d1.clone() });
15

            
16
    let mut m = Model {
17
        variables,
18
        constraints: Expression::And(Vec::new()),
19
    };
20

            
21
    assert_eq!(m.variables.get(&a).unwrap().domain, d1);
22

            
23
    m.update_domain(&a, d2.clone());
24

            
25
    assert_eq!(m.variables.get(&a).unwrap().domain, d2);
26
}