2021-12-30 16:09:07 -08:00
|
|
|
pub(super) mod allocations;
|
2019-10-24 12:01:27 -07:00
|
|
|
pub(super) mod edits;
|
2019-01-25 16:40:26 -08:00
|
|
|
pub(super) mod fixtures;
|
2021-05-31 23:14:36 -07:00
|
|
|
pub(super) mod query_helpers;
|
2019-01-25 16:40:26 -08:00
|
|
|
pub(super) mod random;
|
|
|
|
|
pub(super) mod scope_sequence;
|
2021-05-31 23:14:36 -07:00
|
|
|
|
|
|
|
|
use lazy_static::lazy_static;
|
2023-03-16 15:08:56 +02:00
|
|
|
use rand::Rng;
|
|
|
|
|
use std::env;
|
2021-05-31 23:14:36 -07:00
|
|
|
|
|
|
|
|
lazy_static! {
|
2022-03-02 16:45:54 -08:00
|
|
|
pub static ref LOG_ENABLED: bool = env::var("TREE_SITTER_LOG").is_ok();
|
|
|
|
|
pub static ref LOG_GRAPH_ENABLED: bool = env::var("TREE_SITTER_LOG_GRAPHS").is_ok();
|
|
|
|
|
pub static ref LANGUAGE_FILTER: Option<String> = env::var("TREE_SITTER_LANGUAGE").ok();
|
|
|
|
|
pub static ref EXAMPLE_FILTER: Option<String> = env::var("TREE_SITTER_EXAMPLE").ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lazy_static! {
|
2023-03-16 15:08:56 +02:00
|
|
|
pub static ref START_SEED: usize = new_seed();
|
2022-03-02 16:45:54 -08:00
|
|
|
pub static ref EDIT_COUNT: usize = int_env_var("TREE_SITTER_EDITS").unwrap_or(3);
|
|
|
|
|
pub static ref ITERATION_COUNT: usize = int_env_var("TREE_SITTER_ITERATIONS").unwrap_or(10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn int_env_var(name: &'static str) -> Option<usize> {
|
|
|
|
|
env::var(name).ok().and_then(|e| e.parse().ok())
|
2021-05-31 23:14:36 -07:00
|
|
|
}
|
2023-03-16 15:08:56 +02:00
|
|
|
|
|
|
|
|
pub(crate) fn new_seed() -> usize {
|
|
|
|
|
int_env_var("TREE_SITTER_SEED").unwrap_or_else(|| {
|
|
|
|
|
let mut rng = rand::thread_rng();
|
|
|
|
|
rng.gen::<usize>()
|
|
|
|
|
})
|
|
|
|
|
}
|