pub mod email {
pub const MIN_LENGTH: usize = 5;
pub const MAX_LENGTH: usize = 255;
}
pub mod display_name {
pub const MAX_LENGTH: usize = 255;
}
pub mod test_case {
pub const MAX_NAME_LENGTH: usize = 200;
pub const PLACEHOLDER_PROMPT_TEMPLATE: &str = "PLACEHOLDER";
}
pub mod user_agent {
pub const MAX_LENGTH: usize = 1000;
}
pub mod tag {
pub const MAX_LENGTH: usize = 100;
pub const VALIDATION_PATTERN: &str = r"^[a-zA-Z0-9][a-zA-Z0-9:._-]*$";
}
pub mod ip_address {
pub const TEST_IPV4_VALID: &[&str] = &["192.168.1.1", "10.0.0.0", "255.255.255.255"];
pub const TEST_IPV6_VALID: &[&str] =
&["2001:0db8:85a3:0000:0000:8a2e:0370:7334", "::1", "fe80::1"];
pub const TEST_INVALID: &[&str] = &["256.1.1.1", "192.168.1", "not-an-ip", ""];
}
pub mod content_limits {
pub const SOFT_LIMIT_CHARS: usize = 100_000;
pub const HARD_LIMIT_CHARS: usize = 10_485_760;
pub const CHARS_PER_TOKEN_ESTIMATE: usize = 4;
}
pub mod pattern {
pub const MAX_LENGTH: usize = 1000;
}
pub mod test_runs {
pub const DEFAULT_PROPTEST_CASES: u32 = 100;
pub const SMALL_PROPTEST_RANGE: std::ops::Range<usize> = 1..100;
}
pub mod environment_id {
pub const VALIDATION_PATTERN: &str = r"^[a-z][a-z0-9-]*$";
pub const TEST_VALID: &[&str] = &["production", "staging", "dev-123", "qa"];
pub const TEST_INVALID: &[&str] = &[
"",
"Production", "123prod", "-prod", "prod_us", ];
}
pub mod tokens {
pub const MAX_COUNT: u32 = 1_000_000;
}
pub mod latency {
pub const MAX_MS: u64 = 300_000;
}
pub mod error_message {
pub const MAX_LENGTH: usize = 5000;
}
pub mod field_name {
pub const MAX_LENGTH: usize = 100;
}
pub mod resource_id {
pub const MAX_LENGTH: usize = 200;
}
pub mod application_id {
pub const MAX_LENGTH: usize = 100;
}
pub mod change_reason {
pub const MAX_LENGTH: usize = 1000;
}
pub mod assertion_description {
pub const MAX_LENGTH: usize = 500;
}
pub mod test_case_description {
pub const MAX_LENGTH: usize = 1000;
}
pub mod model_id {
pub const MAX_LENGTH: usize = 200;
}
pub mod finish_reason {
pub const MAX_LENGTH: usize = 100;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_content_limits_are_reasonable() {
assert_eq!(content_limits::SOFT_LIMIT_CHARS, 100_000);
assert_eq!(content_limits::HARD_LIMIT_CHARS, 10_485_760);
assert_eq!(content_limits::CHARS_PER_TOKEN_ESTIMATE, 4);
}
#[test]
fn test_email_limits_are_reasonable() {
assert_eq!(email::MIN_LENGTH, 5);
assert_eq!(email::MAX_LENGTH, 255);
}
#[test]
fn test_test_data_is_not_empty() {
assert_eq!(ip_address::TEST_IPV4_VALID.len(), 3); assert_eq!(ip_address::TEST_IPV6_VALID.len(), 3); assert_eq!(ip_address::TEST_INVALID.len(), 4); assert_eq!(environment_id::TEST_VALID.len(), 4); assert_eq!(environment_id::TEST_INVALID.len(), 5); }
#[test]
fn test_validation_patterns_are_not_empty() {
assert!(tag::VALIDATION_PATTERN.len() > 10); assert!(environment_id::VALIDATION_PATTERN.len() > 10);
}
}