summaryrefslogtreecommitdiffstats
path: root/intl/l10n/rust/l10nregistry-tests/src/solver/mod.rs
blob: 68f566250e218de529b7035157a4f890411091c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
mod scenarios;

pub use scenarios::get_scenarios;

/// Define a testing scenario.
pub struct Scenario {
    /// Name of the scenario.
    pub name: String,
    /// Number of resources.
    pub width: usize,
    /// Number of sources.
    pub depth: usize,
    /// Vector of resources, containing a vector of sources, with true indicating
    /// whether the resource is present in that source.
    pub values: Vec<Vec<bool>>,
    /// Vector of solutions, each containing a vector of resources, with the index
    /// indicating from which source the resource is chosen.
    /// TODO(issue#17): This field is currently unused!
    pub solutions: Vec<Vec<usize>>,
}

impl Scenario {
    pub fn new<S: ToString>(
        name: S,
        width: usize,
        depth: usize,
        values: Vec<Vec<bool>>,
        solutions: Vec<Vec<usize>>,
    ) -> Self {
        Self {
            name: name.to_string(),
            width,
            depth,
            values,
            solutions,
        }
    }
}