1
// Tests for various functionalities of the Model
2

            
3
use std::collections::HashMap;
4

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

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

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

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

            
18
    let mut m = Model::new(variables, vec![], Default::default());
19

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

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

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