1pub mod types;
4pub mod ir;
5pub mod prelude {
6 pub use crate::types::*;
8 pub use crate::ir::*;
9}
10
11#[cfg(test)]
12mod tests {
13 use super::*;
14 use crate::types::*;
15
16 #[test]
17 fn test_value_serialization() {
18 let null_val = Value::Null;
20 let json = serde_json::to_string(&null_val).unwrap();
21 assert_eq!(json, "null");
22
23 let bool_val = Value::Bool(true);
24 let json = serde_json::to_string(&bool_val).unwrap();
25 assert_eq!(json, "true");
26
27 let int_val = Value::Int(42);
28 let json = serde_json::to_string(&int_val).unwrap();
29 assert_eq!(json, "42");
30
31 let str_val = Value::String("hello".to_string());
32 let json = serde_json::to_string(&str_val).unwrap();
33 assert_eq!(json, "\"hello\"");
34 }
35
36 #[test]
37 fn test_value_deserialization() {
38 let null_val: Value = serde_json::from_str("null").unwrap();
40 assert_eq!(null_val, Value::Null);
41
42 let bool_val: Value = serde_json::from_str("true").unwrap();
43 assert_eq!(bool_val, Value::Bool(true));
44
45 let int_val: Value = serde_json::from_str("42").unwrap();
46 assert_eq!(int_val, Value::Int(42));
47
48 let str_val: Value = serde_json::from_str("\"hello\"").unwrap();
49 assert_eq!(str_val, Value::String("hello".to_string()));
50 }
51
52 #[test]
53 fn test_content_hash() {
54 let data = [42u8; 32];
56 let hash = ContentHash::sha256(data);
57 assert!(!hash.0.is_empty());
58
59 let hash2 = ContentHash::sha256(data);
61 assert_eq!(hash, hash2);
62 }
63
64 #[test]
65 fn test_uuid_types() {
66 let vertex_id = VertexId::new_v4();
68 let edge_id = EdgeId::new_v4();
69
70 assert_ne!(vertex_id, edge_id); assert_eq!(vertex_id.get_version_num(), 4); assert_eq!(edge_id.get_version_num(), 4);
73 }
74}