1
// Tests for various functionalities of the Model
2

            
3
use std::collections::HashMap;
4

            
5
use conjure_core::metadata::Metadata;
6
use conjure_core::model::Model;
7
use conjure_oxide::ast::*;
8

            
9
#[test]
10
fn modify_domain() {
11
    let a = Name::UserName(String::from("a"));
12

            
13
    let d1 = Domain::IntDomain(vec![Range::Bounded(1, 3)]);
14
    let d2 = Domain::IntDomain(vec![Range::Bounded(1, 2)]);
15

            
16
    let mut variables = HashMap::new();
17
    variables.insert(a.clone(), DecisionVariable { domain: d1.clone() });
18

            
19
    let mut m = Model::new(
20
        variables,
21
        Expression::And(Metadata::new(), Vec::new()),
22
        Default::default(),
23
    );
24

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

            
27
    m.update_domain(&a, d2.clone());
28

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