-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ghost_text.rs
More file actions
61 lines (49 loc) · 1.44 KB
/
test_ghost_text.rs
File metadata and controls
61 lines (49 loc) · 1.44 KB
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
// Test file for ghost text autocomplete
// Try typing the first 2-3 characters of these words and see ghost suggestions
fn authentication_handler() {
println!("authentication started");
}
fn authorization_check() {
println!("authorization verified");
}
fn calculate_total(items: Vec<i32>) -> i32 {
items.iter().sum()
}
fn calculate_average(items: Vec<i32>) -> f64 {
let total = calculate_total(items.clone());
total as f64 / items.len() as f64
}
fn process_request(request: String) {
println!("processing: {}", request);
}
fn process_response(response: String) {
println!("response: {}", response);
}
struct Configuration {
database_url: String,
database_port: u16,
server_host: String,
server_port: u16,
}
impl Configuration {
fn new() -> Self {
Configuration {
database_url: String::from("localhost"),
database_port: 5432,
server_host: String::from("0.0.0.0"),
server_port: 8080,
}
}
}
// Test suggestions:
// Type "auth" -> should suggest "entication" or "orization"
// Type "calc" -> should suggest "ulate_total" or "ulate_average"
// Type "proc" -> should suggest "ess_request" or "ess_response"
// Type "data" -> should suggest "base_url" or "base_port"
// Type "serv" -> should suggest "er_host" or "er_port"
// Type "Conf" -> should suggest "iguration"
fn main() {
let config = Configuration::new();
// Try typing here:
//
}