1
// Tests for various functionalities of the Model
2

            
3
use conjure_core::model::Model;
4
use conjure_oxide::ast::*;
5

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

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

            
13
1
    let mut symbols = SymbolTable::new();
14
1
    symbols.add_var(a.clone(), DecisionVariable { domain: d1.clone() });
15
1

            
16
1
    let mut m = Model::new(symbols, vec![], Default::default());
17
1

            
18
1
    assert_eq!(m.symbols().domain_of(&a).unwrap(), &d1);
19

            
20
1
    m.update_domain(&a, d2.clone());
21
1

            
22
1
    assert_eq!(m.symbols().domain_of(&a).unwrap(), &d2);
23
1
}