1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Kani proofs for URL contract types.
#[cfg(feature = "url")]
use elicitation::{UrlCanBeBase, UrlHttps, UrlValid, UrlWithHost};
// Note: UrlHttp is from urlbytes.rs, not urls.rs
// ============================================================================
// URL Contract Proofs - Wrapper Logic Only
// ============================================================================
//
// These proofs verify ONLY the wrapper logic, not URL parsing.
// We trust the url crate's correctness and verify our contract enforcement.
#[cfg(feature = "url")]
#[kani::proof]
fn verify_url_https_wrapper() {
// Test HTTPS wrapper logic
let result = UrlHttps::new("https://example.com");
match result {
Ok(_url) => {
// HTTPS wrapper constructed successfully
}
Err(e) => {
// Could be invalid URL or not HTTPS
assert!(
matches!(e, elicitation::ValidationError::UrlInvalid)
|| matches!(e, elicitation::ValidationError::UrlNotHttps)
);
}
}
}
#[cfg(feature = "url")]
#[kani::proof]
fn verify_url_valid_wrapper() {
// Test basic URL wrapper
let result = UrlValid::new("https://example.com");
match result {
Ok(_url) => {
// Valid URL wrapper constructed
}
Err(e) => {
assert!(matches!(e, elicitation::ValidationError::UrlInvalid));
}
}
}
#[cfg(feature = "url")]
#[kani::proof]
fn verify_url_with_host_wrapper() {
// Test host requirement wrapper
let result = UrlWithHost::new("https://example.com");
match result {
Ok(_url) => {
// URL with host wrapper constructed
}
Err(e) => {
assert!(
matches!(e, elicitation::ValidationError::UrlInvalid)
|| matches!(e, elicitation::ValidationError::UrlNoHost)
);
}
}
}
#[cfg(feature = "url")]
#[kani::proof]
fn verify_url_can_be_base_wrapper() {
// Test base URL requirement wrapper
let result = UrlCanBeBase::new("https://example.com");
match result {
Ok(_url) => {
// Base URL wrapper constructed
}
Err(e) => {
assert!(
matches!(e, elicitation::ValidationError::UrlInvalid)
|| matches!(e, elicitation::ValidationError::UrlCannotBeBase)
);
}
}
}