AstBuilder: produce ints and floats
This commit is contained in:
parent
dfabbaf6f5
commit
dc52b4fa3c
|
@ -15,8 +15,8 @@
|
||||||
[statements.gen_decl]
|
[statements.gen_decl]
|
||||||
gen_boolean = 0.0
|
gen_boolean = 0.0
|
||||||
gen_character = 0.0
|
gen_character = 0.0
|
||||||
gen_integer = 0.0
|
gen_integer = 0.5
|
||||||
gen_real = 0.0
|
gen_real = 0.5
|
||||||
gen_tuple = 0.0
|
gen_tuple = 0.0
|
||||||
qual_const = 0.0
|
qual_const = 0.0
|
||||||
qual_var = 0.0
|
qual_var = 0.0
|
||||||
|
|
|
@ -53,7 +53,16 @@ impl AstBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gen_decl(&mut self) -> Box<dyn Statement> {
|
fn gen_decl(&mut self) -> Box<dyn Statement> {
|
||||||
let t = BaseType::Real;
|
let p: f64 = self.rng.gen();
|
||||||
|
let ps = &self.params.statements.gen_decl;
|
||||||
|
|
||||||
|
let t = if p < ps.gen_integer {
|
||||||
|
BaseType::Int
|
||||||
|
} else {
|
||||||
|
BaseType::Real
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
let v = self.gen_variable_quantified(t, Quantifier::Const);
|
let v = self.gen_variable_quantified(t, Quantifier::Const);
|
||||||
|
|
||||||
Box::new(
|
Box::new(
|
||||||
|
|
Loading…
Reference in a new issue