forked from AI-Decenter/MerkleKV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_protocol.rs
More file actions
32 lines (27 loc) · 942 Bytes
/
test_protocol.rs
File metadata and controls
32 lines (27 loc) · 942 Bytes
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
fn main() {
// Add the src directory to the path so we can import protocol
use std::path::Path;
use std::env;
// Change to the project directory
let project_dir = Path::new("/home/habogay/projects/MerkleKV");
env::set_current_dir(project_dir).unwrap();
// Add src to the module path and import protocol
mod protocol;
use protocol::Protocol;
let protocol = Protocol::new();
// Test the exact scenarios from the integration test
let test_cases = vec![
"SET key\nvalue value",
"SET key\tvalue value",
"GET key\nvalue",
"GET key\tvalue",
];
for test_case in test_cases {
println!("Testing: {:?}", test_case);
match protocol.parse(test_case) {
Ok(command) => println!(" ✓ Parsed successfully: {:?}", command),
Err(e) => println!(" ✗ Error: {}", e),
}
println!();
}
}