use crate::runner::LeanRunner;
pub const LEAN_BINARY_PATH: &str = "lean/.lake/build/bin/telltale_validator";
pub const STRICT_LEAN_VALIDATOR_ENV: &str = "TELLTALE_REQUIRE_LEAN_VALIDATOR";
pub const LEAN_SKIP_MESSAGE: &str =
"SKIPPED: Lean binary not available. Run `cd lean && lake build telltale_validator` to enable.";
#[must_use]
pub fn lean_available() -> bool {
LeanRunner::is_available()
}
#[must_use]
pub fn strict_lean_validator_required() -> bool {
std::env::var(STRICT_LEAN_VALIDATOR_ENV)
.map(|value| value != "0")
.unwrap_or(false)
}
#[macro_export]
macro_rules! skip_without_lean {
() => {
if !$crate::test_utils::lean_available() {
if $crate::test_utils::strict_lean_validator_required() {
$crate::LeanRunner::require_available();
}
eprintln!("{}", $crate::test_utils::LEAN_SKIP_MESSAGE);
return;
}
};
}
pub const DETERMINISTIC_SEED: [u8; 32] = [
0x52, 0x75, 0x6D, 0x70, 0x73, 0x74, 0x65, 0x61, 0x6B, 0x41, 0x75, 0x72, 0x61, 0x4C, 0x65, 0x61, 0x6E, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x54, 0x65, 0x73, 0x74, 0x53, 0x65, 0x65, 0x64, 0x21, ];
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_lean_available_returns_bool() {
let _available = lean_available();
}
#[test]
fn test_deterministic_seed_is_32_bytes() {
assert_eq!(DETERMINISTIC_SEED.len(), 32);
}
#[test]
fn test_skip_without_lean_macro() {
skip_without_lean!();
}
}